politikorama/migrations/versions/6a205c6b23bb_.py

44 lines
1.2 KiB
Python

"""empty message
Revision ID: 6a205c6b23bb
Revises: bc290d035406
Create Date: 2022-05-27 11:12:44.242389
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '6a205c6b23bb'
down_revision = 'bc290d035406'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('entity',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=200), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('membership',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('representative_id', sa.Integer(), nullable=True),
sa.Column('entity_id', sa.Integer(), nullable=True),
sa.Column('start', sa.Date(), nullable=True),
sa.Column('end', sa.Date(), nullable=True),
sa.ForeignKeyConstraint(['entity_id'], ['entity.id'], ),
sa.ForeignKeyConstraint(['representative_id'], ['representative.id'], ),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('membership')
op.drop_table('entity')
# ### end Alembic commands ###