Commits

Jack Diederich committed 32210fb

generic:_fill_constraint_cache() fixed
remove manual cache invalidation, the decorator does that

Comments (0)

Files changed (1)

south/db/generic.py

 
         for ifsc_table in ifsc_tables:
             rows = self.execute("""
-                SELECT kc.constraint_name, kc.column_name, c.contraint_type
+                SELECT kc.constraint_name, kc.column_name, c.constraint_type
                 FROM information_schema.%s AS kc
                 JOIN information_schema.table_constraints AS c ON
                     kc.table_schema = c.table_schema AND
                     kc.constraint_name = c.constraint_name
                 WHERE
                     kc.table_schema = %%s AND
-                    kc.table_name = %%s AND
-            """ % ifsc_table, [schema, table_name, type])
+                    kc.table_name = %%s
+            """ % ifsc_table, [schema, table_name])
             for constraint, column, kind in rows:
-                self._constraint_cache[db_name][table].setdefault(column, set())
-                self._constraint_cache[db_name][table][column].add((kind, constraint))
+                self._constraint_cache[db_name][table_name].setdefault(column, set())
+                self._constraint_cache[db_name][table_name][column].add((kind, constraint))
         return
 
     def _constraints_affecting_columns(self, table_name, columns, type="UNIQUE"):
         Deletes the column 'column_name' from the table 'table_name'.
         """
         db_name = self._get_setting('NAME')
-        try:
-            self._constraint_cache[db_name][table_name][name] = []
-        except KeyError:
-            pass
         params = (self.quote_name(table_name), self.quote_name(name))
         self.execute(self.delete_column_string % params, [])
 
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.