"""empty message Revision ID: 75074097a2a3 Revises: 8c300c4d43ea Create Date: 2026-07-22 16:11:08.077455 """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision: str = '75074097a2a3' down_revision: Union[str, Sequence[str], None] = '8c300c4d43ea' 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('accountant_settings', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=64), nullable=False), sa.Column('database_key', sa.Uuid(), nullable=False), sa.PrimaryKeyConstraint('id', name=op.f('pk_accountant_settings')), sa.UniqueConstraint('database_key', name=op.f('uq_accountant_settings_database_key')) ) with op.batch_alter_table('accountant_settings', schema=None) as batch_op: batch_op.create_index(batch_op.f('ix_accountant_settings_id'), ['id'], unique=False) batch_op.create_index(batch_op.f('ix_accountant_settings_name'), ['name'], unique=True) op.create_table('doc_types', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=64), nullable=False), sa.PrimaryKeyConstraint('id', name=op.f('pk_doc_types')) ) with op.batch_alter_table('doc_types', schema=None) as batch_op: batch_op.create_index(batch_op.f('ix_doc_types_id'), ['id'], unique=False) batch_op.create_index(batch_op.f('ix_doc_types_name'), ['name'], unique=True) op.create_table('fabric', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=64), nullable=False), sa.PrimaryKeyConstraint('id', name=op.f('pk_fabric')) ) with op.batch_alter_table('fabric', schema=None) as batch_op: batch_op.create_index(batch_op.f('ix_fabric_id'), ['id'], unique=False) batch_op.create_index(batch_op.f('ix_fabric_name'), ['name'], unique=True) op.create_table('goods', sa.Column('id', sa.Integer(), nullable=False), sa.Column('article', sa.String(length=16), nullable=False), sa.Column('price', sa.Numeric(precision=10, scale=2), nullable=False), sa.Column('tnvd', sa.Integer(), nullable=False), sa.Column('doc_type_id', sa.Integer(), nullable=False), sa.Column('fabric_id', sa.Integer(), nullable=False), sa.Column('status', sa.Boolean(), nullable=False), sa.ForeignKeyConstraint(['doc_type_id'], ['doc_types.id'], name=op.f('fk_goods_doc_type_id_doc_types'), ondelete='CASCADE'), sa.ForeignKeyConstraint(['fabric_id'], ['fabric.id'], name=op.f('fk_goods_fabric_id_fabric'), ondelete='CASCADE'), sa.PrimaryKeyConstraint('id', name=op.f('pk_goods')) ) with op.batch_alter_table('goods', schema=None) as batch_op: batch_op.create_index(batch_op.f('ix_goods_article'), ['article'], unique=True) batch_op.create_index(batch_op.f('ix_goods_doc_type_id'), ['doc_type_id'], unique=False) batch_op.create_index(batch_op.f('ix_goods_fabric_id'), ['fabric_id'], unique=False) batch_op.create_index(batch_op.f('ix_goods_id'), ['id'], unique=False) batch_op.create_index(batch_op.f('ix_goods_price'), ['price'], unique=False) batch_op.create_index(batch_op.f('ix_goods_tnvd'), ['tnvd'], unique=True) # ### end Alembic commands ### def downgrade() -> None: """Downgrade schema.""" # ### commands auto generated by Alembic - please adjust! ### with op.batch_alter_table('goods', schema=None) as batch_op: batch_op.drop_index(batch_op.f('ix_goods_tnvd')) batch_op.drop_index(batch_op.f('ix_goods_price')) batch_op.drop_index(batch_op.f('ix_goods_id')) batch_op.drop_index(batch_op.f('ix_goods_fabric_id')) batch_op.drop_index(batch_op.f('ix_goods_doc_type_id')) batch_op.drop_index(batch_op.f('ix_goods_article')) op.drop_table('goods') with op.batch_alter_table('fabric', schema=None) as batch_op: batch_op.drop_index(batch_op.f('ix_fabric_name')) batch_op.drop_index(batch_op.f('ix_fabric_id')) op.drop_table('fabric') with op.batch_alter_table('doc_types', schema=None) as batch_op: batch_op.drop_index(batch_op.f('ix_doc_types_name')) batch_op.drop_index(batch_op.f('ix_doc_types_id')) op.drop_table('doc_types') with op.batch_alter_table('accountant_settings', schema=None) as batch_op: batch_op.drop_index(batch_op.f('ix_accountant_settings_name')) batch_op.drop_index(batch_op.f('ix_accountant_settings_id')) op.drop_table('accountant_settings') # ### end Alembic commands ###