Fix database migrations
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] https://github.com/sqlalchemy/sqlalchemy/issues/5669 Change-Id: I5fd1deeef9cf70794bc61c101e1d7d4379d4b96b
This commit is contained in:
@@ -28,7 +28,8 @@ import sqlalchemy as sa # noqa: E402
|
|||||||
def upgrade():
|
def upgrade():
|
||||||
insecure_column = sa.Column('insecure', sa.Boolean(), default=False)
|
insecure_column = sa.Column('insecure', sa.Boolean(), default=False)
|
||||||
op.add_column('baymodel', insecure_column)
|
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(
|
op.execute(
|
||||||
baymodel.update().values({'insecure': True})
|
baymodel.update().values({'insecure': True})
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Fixes database migrations with SQLAlchemy 1.3.20.
|
||||||
Reference in New Issue
Block a user