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

45 lines
1.3 KiB
Python

"""bought and item
Revision ID: cec6bb222997
Revises: c9dcd301d327
Create Date: 2022-01-21 09:38:53.679649
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'cec6bb222997'
down_revision = 'c9dcd301d327'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('item',
sa.Column('id', sa.BigInteger(), nullable=False),
sa.Column('name', sa.String(length=64), nullable=True),
sa.Column('brand', sa.String(length=32), nullable=True),
sa.Column('description', sa.Text(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('bought',
sa.Column('user', sa.String(length=10), nullable=False),
sa.Column('item', sa.BigInteger(), nullable=False),
sa.Column('date', sa.Date(), nullable=True),
sa.Column('amount', sa.SmallInteger(), nullable=True),
sa.ForeignKeyConstraint(['item'], ['item.id'], ),
sa.ForeignKeyConstraint(['user'], ['user.id'], ),
sa.PrimaryKeyConstraint('user', 'item')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('bought')
op.drop_table('item')
# ### end Alembic commands ###