politikorama/migrations/versions/f448ec882889_.py

46 lines
1.4 KiB
Python

"""empty message
Revision ID: f448ec882889
Revises: cd76771172a8
Create Date: 2022-05-28 18:53:26.059567
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'f448ec882889'
down_revision = 'cd76771172a8'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('source',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=200), nullable=True),
sa.Column('slug', sa.String(length=200), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('representative_origin',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('representative_id', sa.Integer(), nullable=True),
sa.Column('source_id', sa.Integer(), nullable=True),
sa.Column('reference', sa.String(length=200), nullable=True),
sa.ForeignKeyConstraint(['representative_id'], ['representative.id'], ),
sa.ForeignKeyConstraint(['source_id'], ['source.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.add_column('role', sa.Column('code', sa.String(length=200), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('role', 'code')
op.drop_table('representative_origin')
op.drop_table('source')
# ### end Alembic commands ###