upgrades: InnoDB upgrade fix #9
upgrades: InnoDB upgrade fix #9
Conversation
"SELECT CONCAT('ALTER TABLE ',TABLE_NAME,' ENGINE=InnoDB;')" | ||
" FROM INFORMATION_SCHEMA.TABLES" | ||
" WHERE ENGINE='MyISAM'" | ||
" AND table_schema = %s", | ||
(current_app.config.get('CFG_DATABASE_NAME'),) | ||
) | ||
[run_sql(row[0]) for row in rows] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for row in rows:
run_sql(row[0])
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for row in rows:
run_sql("ALTER TABLE '%s' ENGINE=InnoDB;", row[0])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try to do it using alembic instead, I'll update the PR asap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not gonna happen 😢
@@ -39,13 +39,14 @@ def do_upgrade(): | |||
"""Carry out the upgrade.""" | |||
from flask import current_app | |||
if current_app.config.get('CFG_DATABASE_TYPE') == 'mysql': | |||
run_sql( | |||
rows = run_sql( | |||
"SELECT CONCAT('ALTER TABLE ',TABLE_NAME,' ENGINE=InnoDB;')" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"SELECT TABLE_NAME"
8038ed8
to
8c434c1
Compare
(current_app.config.get('CFG_DATABASE_NAME'),) | ||
) | ||
for table_name in table_names: | ||
run_sql("ALTER TABLE `%s` ENGINE=InnoDB" % (table_name[0],)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it doesn't make sense to change because actually this query is valid only for mysql.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
It seems to be running just fine for CDS database, although it takes a lot of time |
* FIX Runs the sql statement which actually changes the engine from MyISAM to InnoDB. Signed-off-by: Esteban J. G. Gabancho <esteban.gabancho@gmail.com>
8c434c1
to
b0cbb9c
Compare
MyISAM to InnoDB.
Signed-off-by: Esteban J. G. Gabancho esteban.gabancho@gmail.com