Fixing database migrations - will require a delete of the database.
This commit is contained in:
parent
c4cbaeb64e
commit
782271885a
|
@ -1,32 +0,0 @@
|
|||
""" 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 ###
|
|
@ -1,8 +1,8 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: cb645597b71b
|
||||
Revision ID: 9d233e1c58b1
|
||||
Revises: 53596ce86e7e
|
||||
Create Date: 2019-12-27 13:50:31.336513
|
||||
Create Date: 2020-01-02 10:13:24.486261
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
|
@ -10,7 +10,7 @@ import sqlalchemy as sa
|
|||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'cb645597b71b'
|
||||
revision = '9d233e1c58b1'
|
||||
down_revision = '53596ce86e7e'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
@ -33,7 +33,8 @@ def upgrade():
|
|||
op.create_table('file_data',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('data', sa.LargeBinary(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['id'], ['file.id'], ),
|
||||
sa.Column('file_model_id', sa.Integer(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['file_model_id'], ['file.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
# ### end Alembic commands ###
|
Loading…
Reference in New Issue