F. Gabriel Gosselin avatar F. Gabriel Gosselin committed 577f264

Moved debug statement in generic to more useful place (remove dry run output)
Added more check to invalidate_table_constraints to avoid KeyError
Forced delete_table to invalidate through MySQL to clear lingering constraints

Comments (0)

Files changed (2)


         if self.debug:
             print "   = %s" % sql, params
-        get_logger().debug('south execute "%s" with params "%s"' % (sql, params))
         if self.dry_run:
             return []
+        get_logger().debug('execute "%s" with params "%s"' % (sql, params))
             cursor.execute(sql, params)
         except DatabaseError, e:


         db_name = self._get_setting('NAME')
         if db_name in self._constraint_cache:
             del self._constraint_cache[db_name]
+        if db_name in self._reverse_cache:
             del self._reverse_cache[db_name]
+        if db_name in self._constraint_references:
             del self._constraint_references[db_name]
         return func(self, table, *args, **opts)
     return _cache_clear
         super(DatabaseOperations, self).rename_table(old_table_name,
+    @invalidate_table_constraints
+    def delete_table(self, table_name):
+        super(DatabaseOperations, self).delete_table(table_name)
     def _lookup_constraint_references(self, table_name, cname):
         Provided an existing table and constraint, returns tuple of (foreign
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.