Tai Lee  committed 94f9459

Fixed #1172 -- Skip explicit creation of indexes in SQLite if table has already been "remade", which implicitly creates all table indexes.

  • Participants
  • Parent commits 74742a1
  • Branches bug-1172

Comments (0)

Files changed (1)

File south/db/

     has_check_constraints = False
     has_booleans = False
+    def __init__(self, *args, **kwargs):
+        super(DatabaseOperations, self).__init__(*args, **kwargs)
+        self._remade_tables = set()
     def add_column(self, table_name, name, field, *args, **kwds):
         Adds a column.
         # We can't do that before since it's impossible to rename indexes
         # and index name scope is global
         self._make_multi_indexes(table_name, multi_indexes, renames=renames, deleted=deleted, uniques_deleted=uniques_deleted)
+        # add table name to list, so we can skip creation of indexes later on.
+        self._remade_tables.add(table_name)
     def _copy_data(self, src, dst, field_renames={}):
         "Used to copy data into a new table"
         elif default == False:
             default = 0
         return default
+    def create_index(self, table_name, *args, **kwargs):
+        """
+        Executes a create index statement.
+        Skips if table has already been remade.
+        """
+        if table_name not in self._remade_tables:
+            super(DatabaseOperations, self).create_index(table_name, *args, **kwargs)