Merge "db: Replace use of Connection.execute"

This commit is contained in:
Zuul 2023-11-08 21:09:00 +00:00 committed by Gerrit Code Review
commit bd786113ce
1 changed files with 5 additions and 5 deletions

View File

@ -919,19 +919,19 @@ def upgrade():
"image_volume_cache_entries",
]
connection.execute("SET foreign_key_checks = 0")
op.execute("SET foreign_key_checks = 0")
for table in tables:
connection.execute(
op.execute(
"ALTER TABLE %s CONVERT TO CHARACTER SET utf8" % table
)
connection.execute("SET foreign_key_checks = 1")
connection.execute(
op.execute("SET foreign_key_checks = 1")
op.execute(
"ALTER DATABASE %s DEFAULT CHARACTER SET utf8"
% connection.engine.url.database
)
connection.execute("ALTER TABLE %s Engine=InnoDB" % table)
op.execute("ALTER TABLE %s Engine=InnoDB" % table)
# This is only necessary for mysql, and since the table is not in use this
# will only be a schema update.