Anonymous committed 4a03dce

[multi-db] Fixed orphan pending error message. Changed get_create_table to only fill pending if backend supports constraints.

Comments (0)

Files changed (2)


             models_installed = manager.get_installed_models(tables)
             for model in pending.keys():
+                manager = model._default_manager
                 if model in models_installed:
                     for rel_class, f in pending[model]:
-                        manager = model._default_manager 
                         for statement in manager.get_pending(rel_class, f):
-                    raise Exception("%s is not installed, but there are "
-                                    "pending statements that need it: %s"
-                                    % (model, statements))
+                    raise Exception("%s is not installed, but it has pending "
+                                    "references" % model)
     except Exception, e:
         import traceback
         print traceback.format_exception(*sys.exc_info())


                         # We haven't yet created the table to which this field
                         # is related, so save it for later.
-                        pending.setdefault(, []).append((model, f))
+                        if backend.supports_constraints:
+                            pending.setdefault(, []).append((model, f))
                 table_output.append(' '.join(field_output))
         if opts.order_with_respect_to:
             table_output.append(style.SQL_FIELD(quote_name('_order')) + ' ' + \
         create = [BoundStatement('\n'.join(full_statement), db.connection)]
         # Pull out any pending statements for me
-        if (pending and
-            backend.supports_constraints):
+        if pending:
             if model in pending:
                 for rel_class, f in pending[model]:
                     create.append(self.get_ref_sql(model, rel_class, f,
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
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.