Catalog with photos and append-only print-file revisions, a stock ledger attributing every take/restock/adjust to a badge-resolved employee, a touch kiosk (scan bin, scan badge, keypad quantity) with a deliberately open decrement-only take endpoint, 1x0.5in CODE128 bin labels, low-stock email alerts to selected users, roles, or addresses, and stock/consumption/by-person reports with a cache-vs-ledger reconcile. Ships disabled; enable per site. Contract 0.13.0 adds the mailer and the User/Role models to the plugin surface.
44 lines
1.7 KiB
Python
44 lines
1.7 KiB
Python
"""Add printeditemfiles: append-only print-file revisions per item.
|
|
|
|
The plugin's first incremental migration on top of its 0001 baseline -
|
|
the ADR-008 payoff: the plugin evolves its own schema without touching
|
|
the core chain. Applied by `flask plugin upgrade-all`.
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = 'printedparts0002files'
|
|
down_revision = 'printedparts0001baseline'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
op.create_table(
|
|
'printeditemfiles',
|
|
sa.Column('fileid', sa.Integer(), nullable=False),
|
|
sa.Column('printeditemid', sa.Integer(), nullable=False),
|
|
sa.Column('revision', sa.Integer(), nullable=False),
|
|
sa.Column('filename', sa.String(length=255), nullable=False),
|
|
sa.Column('storedfilename', sa.String(length=191), nullable=False),
|
|
sa.Column('filesize', sa.Integer(), nullable=False),
|
|
sa.Column('uploadnote', sa.String(length=255), nullable=True),
|
|
sa.Column('uploadedby', sa.String(length=80), nullable=False),
|
|
sa.Column('createddate', sa.DateTime(), nullable=False),
|
|
sa.Column('modifieddate', sa.DateTime(), nullable=False),
|
|
sa.Column('isactive', sa.Boolean(), nullable=False),
|
|
sa.ForeignKeyConstraint(['printeditemid'],
|
|
['printeditems.printeditemid'],
|
|
ondelete='CASCADE'),
|
|
sa.PrimaryKeyConstraint('fileid'),
|
|
sa.UniqueConstraint('storedfilename'),
|
|
)
|
|
op.create_index('ix_printeditemfiles_printeditemid',
|
|
'printeditemfiles', ['printeditemid'])
|
|
|
|
|
|
def downgrade():
|
|
op.drop_table('printeditemfiles')
|