diff options
| author | Jason Pellerin <jpellerin@gmail.com> | 2006-09-15 02:24:38 +0000 |
|---|---|---|
| committer | Jason Pellerin <jpellerin@gmail.com> | 2006-09-15 02:24:38 +0000 |
| commit | ecb5b81e0d3f0a50f33dcf1d4adfb11d34608a2c (patch) | |
| tree | cb1bc3d5d8d2443c1d8d8d8ff6db2978aa4f1baa | |
| parent | c01d2f4e6a77b7b96a57d43e4c7cfc4c4865f056 (diff) | |
[multi-db] Fixed orphan pending error message. Changed get_create_table to only fill pending if backend supports constraints.
git-svn-id: http://code.djangoproject.com/svn/django/branches/multiple-db-support@3762 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/core/management.py | 7 | ||||
| -rw-r--r-- | django/db/backends/ansi/sql.py | 6 |
2 files changed, 6 insertions, 7 deletions
diff --git a/django/core/management.py b/django/core/management.py index f4f83e698a..1482da0ed5 100644 --- a/django/core/management.py +++ b/django/core/management.py @@ -411,16 +411,15 @@ def _install(app, commit=True, initial_data=True): 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): statement.execute() pending.pop(model) else: - 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()) diff --git a/django/db/backends/ansi/sql.py b/django/db/backends/ansi/sql.py index d830e9ccb2..bd7f78d131 100644 --- a/django/db/backends/ansi/sql.py +++ b/django/db/backends/ansi/sql.py @@ -103,7 +103,8 @@ class SchemaBuilder(object): else: # We haven't yet created the table to which this field # is related, so save it for later. - pending.setdefault(f.rel.to, []).append((model, f)) + if backend.supports_constraints: + pending.setdefault(f.rel.to, []).append((model, f)) table_output.append(' '.join(field_output)) if opts.order_with_respect_to: table_output.append(style.SQL_FIELD(quote_name('_order')) + ' ' + \ @@ -124,8 +125,7 @@ class SchemaBuilder(object): 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, |
