"""Add printeditems.gagelabtag: the gage-lab assigned asset tag.

The gage lab issues WJRP asset numbers for printed parts; the internal
itemcode stays auto-generated, and this optional unique tag carries the
lab's number. The kiosk resolves scans/typed digits against both.
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'printedparts0003gagetag'
down_revision = 'printedparts0002files'
branch_labels = None
depends_on = None


def upgrade():
    op.add_column('printeditems',
                  sa.Column('gagelabtag', sa.String(length=50), nullable=True))
    op.create_index('ix_printeditems_gagelabtag', 'printeditems',
                    ['gagelabtag'], unique=True)


def downgrade():
    op.drop_index('ix_printeditems_gagelabtag', table_name='printeditems')
    op.drop_column('printeditems', 'gagelabtag')
