1. Lucian Ursu
  2. south


and...@69d324d9-c39d-4fdc-8679-7745eae9e2c8  committed ab2cd6c

Fix for #66: Incorrect delete_column with FKs and startmigration. Also added a DATABASE_STORAGE_ENGINE conf option in case you want to set it automatically.

  • Participants
  • Parent commits da1d6a8
  • Branches default

Comments (0)

Files changed (2)

File db/mysql.py

View file
 from django.db import connection
+from django.conf import settings
 from south.db import generic
 class DatabaseOperations(generic.DatabaseOperations):
     drop_index_string = 'DROP INDEX %(index_name)s ON %(table_name)s'
     allows_combined_alters = False
     has_ddl_transactions = False
+    def execute(self, sql, params=[]):
+        if hasattr(settings, "DATABASE_STORAGE_ENGINE") and \
+           settings.DATABASE_STORAGE_ENGINE:
+            generic.DatabaseOperations.execute(self, "SET storage_engine=%s;" %
+                settings.DATABASE_STORAGE_ENGINE)
+        return generic.DatabaseOperations.execute(self, sql, params)
+    execute.__doc__ = generic.DatabaseOperations.execute.__doc__
     def rename_column(self, table_name, old, new):
         if old == new or self.dry_run:

File management/commands/startmigration.py

View file
-            field.name,
+            field.column,
         if models_to_migrate: