Changes between Initial Version and Version 1 of MySQLStorageEngine


Ignore:
Timestamp:
Dec 7, 2011, 3:33:53 PM (13 years ago)
Author:
Damien Nozay
Comment:

management.py trick for innodb storage_engine with mysql.

Legend:

Unmodified
Added
Removed
Modified
  • MySQLStorageEngine

    v1 v1  
     1
     2As discussed in the documentation[#foot1 (1)]:
     3- After syncdb, execute an ALTER TABLE statement to convert tables
     4{{{
     5ALTER TABLE <tablename> ENGINE=INNODB;
     6}}}
     7- or, change settings to use the init_command option for MySQLdb:
     8{{{#!python
     9# settings.py
     10DATABASES = {
     11    'default': {
     12         'OPTIONS': {
     13             # works because South changes table creation
     14             'init_command': 'SET storage_engine=INNODB',
     15         }
     16    }
     17}
     18}}}
     19- or, use post_syncdb trick listed in wiki:AlterModelOnSyncDB,
     20- or, create a management.py file along with your app, with:
     21{{{#!python
     22# management.py
     23from django.db import connection
     24# syncdb does "import_module('.management', app_name)"
     25# IOW, this gets executed before creating the tables.
     26connection.cursor().execute('SET storage_engine=InnoDB;')
     27}}}
     28- or, if you use South[#foot2 (2)] for migrations, with:
     29{{{#!python
     30# settings.py
     31DATABASES = {
     32    'default': {
     33        'STORAGE_ENGINE': 'INNODB'
     34    }
     35}
     36}}}
     37- or, if you can, edit my.cnf
     38{{{
     39# my.cnf
     40default-storage-engine=InnoDB
     41}}}
     42
     43* [=#foot1 (1)] https://docs.djangoproject.com/en/dev/ref/databases/#creating-your-tables
     44* [=#foot2 (2)] http://south.aeracode.org/docs/settings.html#mysql-storage-engine
Back to Top