Skip to content

Instantly share code, notes, and snippets.

@adw0rd
Created February 29, 2012 04:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adw0rd/1937616 to your computer and use it in GitHub Desktop.
Save adw0rd/1937616 to your computer and use it in GitHub Desktop.
Converter from MyISAM to InnoDB
from django.db import connection
exclude_tables = ("example", )
c = connection.cursor()
c.execute("SHOW TABLE STATUS WHERE ENGINE='MyISAM'")
for line in c.fetchall():
table_name = line[0]
if table_name in exclude_tables:
continue
c.execute("ALTER TABLE `{}` ENGINE=InnoDB".format(table_name))
print ">>> {} is converted!".format(table_name)
@adw0rd
Copy link
Author

adw0rd commented Feb 29, 2012

Можно в джанго-комаду это обернуть, но скорее больше не понадобится :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment