Skip to content

Commit

Permalink
Fix database migrations
Browse files Browse the repository at this point in the history
The pattern of adding a column and then reading a table with it
no longer works in SQLAlchemy 1.3.20. This has been reported
upstream [1].

[1] sqlalchemy/sqlalchemy#5669

Change-Id: I5fd1deeef9cf70794bc61c101e1d7d4379d4b96b
(cherry picked from commit f5cf6b9)
  • Loading branch information
openstacker authored and brtkwr committed Feb 11, 2021
1 parent 83e643f commit f636e72
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
def upgrade():
insecure_column = sa.Column('insecure', sa.Boolean(), default=False)
op.add_column('baymodel', insecure_column)
baymodel = sa.sql.table('baymodel', insecure_column)
baymodel = sa.sql.table('baymodel',
sa.Column('insecure', sa.Boolean(), default=False))
op.execute(
baymodel.update().values({'insecure': True})
)
4 changes: 4 additions & 0 deletions releasenotes/notes/migrations-1.3.20-60e5f990422f2ca5.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
fixes:
- |
Fixes database migrations with SQLAlchemy 1.3.20.

0 comments on commit f636e72

Please sign in to comment.