Consolidate bundled plugin schema into the core migration chain

The core chain already owns and reproduces the full bundled schema (deploys run
`flask db upgrade` only). The per-plugin Alembic baselines duplicated those
tables, so `flask plugin upgrade-all` would conflict - a footgun. Remove the 6
bundled plugin migration dirs; the per-plugin Alembic helpers
(alembic_template, PluginMigrationRunner) remain for external/filesystem
plugins. upgrade-all now cleanly no-ops for bundled plugins.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
cproudlock
2026-06-26 14:48:07 -04:00
parent 919e0b8600
commit 4f1638bda0
28 changed files with 7 additions and 662 deletions

View File

@@ -1,27 +0,0 @@
"""printers plugin: baseline schema
Creates every table owned by the printers plugin per
shopdb.plugins.alembic_template.PLUGIN_TABLE_OWNERS. The table definitions
are derived from the SQLAlchemy models at migration runtime so this stays
in lockstep with the model layer without duplication.
Revision ID: 0001_baseline_printers
Revises:
Create Date: 2026-05-30
"""
from shopdb.plugins.alembic_template import create_plugin_tables, drop_plugin_tables
revision = '0001_baseline_printers'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
create_plugin_tables('printers')
def downgrade():
drop_plugin_tables('printers')

View File

@@ -1,44 +0,0 @@
"""printers plugin: add modelsupplies table
Data-driven model -> toner/drum/waste part-number mapping. Replaces the old
hardcoded supply_parts table.
Revision ID: 0002_modelsupplies_printers
Revises: 0001_baseline_printers
Create Date: 2026-06-25
"""
import sqlalchemy as sa
from alembic import op
revision = '0002_modelsupplies_printers'
down_revision = '0001_baseline_printers'
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
'modelsupplies',
sa.Column('modelsupplyid', sa.Integer, primary_key=True),
sa.Column('modelnumberid', sa.Integer,
sa.ForeignKey('models.modelnumberid'), nullable=False),
sa.Column('supplytype', sa.String(20), nullable=False, server_default='toner'),
sa.Column('color', sa.String(20), nullable=False, server_default='none'),
sa.Column('capacitytier', sa.String(20), nullable=False, server_default='standard'),
sa.Column('partnumber', sa.String(50), nullable=False),
sa.Column('marketingname', sa.String(120)),
sa.Column('pageyield', sa.Integer),
sa.Column('notes', sa.Text),
sa.Column('createddate', sa.DateTime, nullable=False),
sa.Column('modifieddate', sa.DateTime, nullable=False),
sa.Column('isactive', sa.Boolean, nullable=False, server_default=sa.true()),
sa.UniqueConstraint('modelnumberid', 'partnumber', name='uq_modelsupply_part'),
)
op.create_index('idx_modelsupplies_modelnumberid', 'modelsupplies', ['modelnumberid'])
def downgrade():
op.drop_index('idx_modelsupplies_modelnumberid', table_name='modelsupplies')
op.drop_table('modelsupplies')