""" Don't use a primary key as the foreign key, things blow up. Revision ID: 555d3c6c0f9a Revises: cb645597b71b Create Date: 2019-12-30 15:58:20.633838 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '555d3c6c0f9a' down_revision = 'cb645597b71b' branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('file_data', sa.Column('file_model_id', sa.Integer(), nullable=True)) op.drop_constraint(None, 'file_data', type_='foreignkey') op.create_foreign_key(None, 'file_data', 'file', ['file_model_id'], ['id']) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_constraint(None, 'file_data', type_='foreignkey') op.create_foreign_key(None, 'file_data', 'file', ['id'], ['id']) op.drop_column('file_data', 'file_model_id') # ### end Alembic commands ###