63 lines
2.9 KiB
Python
63 lines
2.9 KiB
Python
"""asdf
|
|
|
|
Revision ID: 420691c16f3c
|
|
Revises: 236605bcac6e
|
|
Create Date: 2025-07-26 14:32:15.012286
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = '420691c16f3c'
|
|
down_revision: Union[str, None] = '236605bcac6e'
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
"""Upgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('inventory_labels',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('uuid', sa.String(), nullable=True),
|
|
sa.Column('upc', sa.String(), nullable=True),
|
|
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
|
|
sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
|
|
sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_index(op.f('ix_inventory_labels_id'), 'inventory_labels', ['id'], unique=False)
|
|
op.create_index(op.f('ix_inventory_labels_upc'), 'inventory_labels', ['upc'], unique=False)
|
|
op.create_index(op.f('ix_inventory_labels_uuid'), 'inventory_labels', ['uuid'], unique=False)
|
|
op.create_table('inventory_label_metadata',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('inventory_label_id', sa.Integer(), nullable=True),
|
|
sa.Column('metadata_key', sa.String(), nullable=True),
|
|
sa.Column('metadata_value', sa.String(), nullable=True),
|
|
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
|
|
sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
|
|
sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True),
|
|
sa.ForeignKeyConstraint(['inventory_label_id'], ['inventory_labels.id'], ),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_index(op.f('ix_inventory_label_metadata_id'), 'inventory_label_metadata', ['id'], unique=False)
|
|
op.create_index(op.f('ix_inventory_label_metadata_metadata_key'), 'inventory_label_metadata', ['metadata_key'], unique=False)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
"""Downgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_index(op.f('ix_inventory_label_metadata_metadata_key'), table_name='inventory_label_metadata')
|
|
op.drop_index(op.f('ix_inventory_label_metadata_id'), table_name='inventory_label_metadata')
|
|
op.drop_table('inventory_label_metadata')
|
|
op.drop_index(op.f('ix_inventory_labels_uuid'), table_name='inventory_labels')
|
|
op.drop_index(op.f('ix_inventory_labels_upc'), table_name='inventory_labels')
|
|
op.drop_index(op.f('ix_inventory_labels_id'), table_name='inventory_labels')
|
|
op.drop_table('inventory_labels')
|
|
# ### end Alembic commands ###
|