Fix migrations for real this time

This commit is contained in:
Julian Rota 2022-06-09 23:53:16 -04:00 committed by Ben Rog-Wilhelm
parent eef55c1ebb
commit 6312ebea16
3 changed files with 5 additions and 7 deletions

View file

@ -21,7 +21,7 @@ def upgrade():
op.execute("UPDATE submissions SET filter_state = 'normal';")
op.alter_column('submissions', 'filter_state', nullable=False)
op.drop_constraint('flags_pkey', 'flags')
op.add_column('flags', sa.Column('id', sa.Integer, nullable=False, primary_key=True, autoincrement=True))
op.execute('alter table flags add column id serial primary key')
def downgrade():

View file

@ -21,12 +21,10 @@ def upgrade():
op.execute("UPDATE comments SET filter_state = 'normal';")
op.alter_column('comments', 'filter_state', nullable=False)
op.drop_constraint('commentflags_pkey', 'commentflags')
op.add_column('commentflags', sa.Column('id', sa.Integer, nullable=False, primary_key=True, autoincrement=True))
op.alter_column('commentflags', 'comment_id', nullable=True)
op.alter_column('commentflags', 'user_id', nullable=True)
op.execute('alter table commentflags add column id serial primary key')
def downgrade():
op.drop_column('comments', 'filter_state')
op.drop_column('commentflags', 'id')
op.create_primary_key('commentflags_pkey', 'commentflags', ['post_id', 'user_id'])
op.create_primary_key('commentflags_pkey', 'commentflags', ['comment_id', 'user_id'])