CostHive/migrations/versions/97738dc497a8_full_structure.py
Lunaresk e73cd46611 major: new repo structure
Moved the client and server in different repositories.
2022-02-03 09:59:48 +01:00

65 lines
2.1 KiB
Python

"""full structure
Revision ID: 97738dc497a8
Revises: cec6bb222997
Create Date: 2022-02-01 01:21:55.570500
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '97738dc497a8'
down_revision = 'cec6bb222997'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('brand',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=32), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('category',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=32), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('amount__change',
sa.Column('item', sa.Integer(), nullable=False),
sa.Column('date', sa.Date(), nullable=False),
sa.Column('Amount', sa.SmallInteger(), nullable=True),
sa.ForeignKeyConstraint(['item'], ['item.id'], ),
sa.PrimaryKeyConstraint('item', 'date')
)
op.create_table('item_category',
sa.Column('item', sa.Integer(), nullable=False),
sa.Column('category', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['category'], ['category.id'], ),
sa.ForeignKeyConstraint(['item'], ['item.id'], ),
sa.PrimaryKeyConstraint('item', 'category')
)
op.create_table('price__change',
sa.Column('item', sa.Integer(), nullable=False),
sa.Column('date', sa.Date(), nullable=False),
sa.Column('price', sa.SmallInteger(), nullable=True),
sa.ForeignKeyConstraint(['item'], ['item.id'], ),
sa.PrimaryKeyConstraint('item', 'date')
)
op.create_foreign_key(None, 'item', 'brand', ['brand'], ['id'])
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, 'item', type_='foreignkey')
op.drop_table('price__change')
op.drop_table('item_category')
op.drop_table('amount__change')
op.drop_table('category')
op.drop_table('brand')
# ### end Alembic commands ###