Fix use of legacy Alembic API

The `name` keyword argument for Operations.alter_column() has been
deprecated since version 0.8. It was finally removed in Alembic 1.5.0,
causing the following error during installation of Blazar:

TypeError: alter_column() got multiple values for keyword argument 'name'

Change-Id: I05541da4d87575f65d8e78f0fc54bd415328b9f2
Closes-Bug: #1912502
This commit is contained in:
Pierre Riteau 2021-01-20 16:29:18 +01:00
parent 0913a41c43
commit b1841dc4b9
2 changed files with 7 additions and 2 deletions

View File

@ -40,7 +40,7 @@ def upgrade():
op.execute('ALTER TABLE tmp_leases RENAME TO leases')
return
op.alter_column('leases', 'tenant_id', name='project_id',
op.alter_column('leases', 'tenant_id', new_column_name='project_id',
existing_type=sa.String(length=255))
@ -55,5 +55,5 @@ def downgrade():
op.execute('ALTER TABLE tmp_leases RENAME TO leases')
return
op.alter_column('leases', 'project_id', name='tenant_id',
op.alter_column('leases', 'project_id', new_column_name='tenant_id',
existing_type=sa.String(length=255))

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Fixes database migrations with Alembic 1.5.0 or greater. For more details,
see `bug 1912502 <https://bugs.launchpad.net/blazar/+bug/1912502>`_.