Also prefix the alembic_version table

We need to prefix all tables if we configured a prefix. That includes
the alembic version table.

Change-Id: Ie80544cca8aeb6c8bc66e1eea7722b4a8ed7f8dc
This commit is contained in:
Tobias Henkel 2017-12-18 21:14:21 +01:00
parent e042e4f735
commit 56fc36dd60
No known key found for this signature in database
GPG Key ID: 03750DEC158E5FA2
2 changed files with 11 additions and 1 deletions

View File

@ -0,0 +1,9 @@
---
upgrade:
- |
The alembic version table is fixed to being prefixed too. This is necessary
when using :attr:`<sql connection>.table_prefix`. However if you are
already using ``table_prefix`` you will need to rename the table
``alembic_version`` to ``<prefix>alembic_version`` before starting Zuul.
Otherwise zuul will try to create the tables again and fail. If you're not
using ``table_prefix`` you can safely ignore this.

View File

@ -65,7 +65,8 @@ def run_migrations_online():
with connectable.connect() as connection:
context.configure(
connection=connection,
target_metadata=target_metadata
target_metadata=target_metadata,
version_table=table_prefix + 'alembic_version'
)
with context.begin_transaction():