Skip to content

Commit

Permalink
db: rename_table is not a batch operation
Browse files Browse the repository at this point in the history
This is reported upstream [1] but I suspect the root cause is that we
were relying on a bug in Alembic: renaming tables doesn't really make
sense as a batch operation, which by definition works by recreating
tables with an updated schema (to support SQLite and its lack of full
'ALTER' support).

[1] sqlalchemy/alembic#1453

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I1da6d117778bbbad64b2df2dfd2f8aeef8a7084c
  • Loading branch information
stephenfin committed Apr 5, 2024
1 parent 9c94a9a commit 825ee37
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,9 @@ def upgrade_export_locations_table(connection):
with op.batch_alter_table("share_export_locations") as batch_op:
batch_op.drop_constraint('sel_id_fk', type_='foreignkey')
batch_op.drop_column('share_id')
batch_op.rename_table('share_export_locations',
'share_instance_export_locations')

op.rename_table(
'share_export_locations', 'share_instance_export_locations')


def downgrade_export_locations_table(connection):
Expand Down

0 comments on commit 825ee37

Please sign in to comment.