Skip to content
This repository has been archived by the owner on May 3, 2020. It is now read-only.

Commit

Permalink
upgrades: InnoDB upgrade fix
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
egabancho committed Sep 18, 2015
1 parent 70e269f commit 8c434c1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions invenio_upgrader/upgrades/invenio_2015_07_14_innodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ def do_upgrade():
"""Carry out the upgrade."""
from flask import current_app
if current_app.config.get('CFG_DATABASE_TYPE') == 'mysql':
run_sql(
"SELECT CONCAT('ALTER TABLE ',TABLE_NAME,' ENGINE=InnoDB;')"
table_names = run_sql(
"SELECT TABLE_NAME"
" FROM INFORMATION_SCHEMA.TABLES"
" WHERE ENGINE='MyISAM'"
" AND table_schema = %s",
" AND table_schema=%s",
(current_app.config.get('CFG_DATABASE_NAME'),)
)
for table_name in table_names:
run_sql("ALTER TABLE `%s` ENGINE=InnoDB" % (table_name[0],))


def estimate():
Expand Down

0 comments on commit 8c434c1

Please sign in to comment.