From 2166f4b0771feeec57706fb14a072d60a71351d9 Mon Sep 17 00:00:00 2001 From: Ben Cail Date: Tue, 15 Oct 2024 15:14:31 -0400 Subject: [PATCH] adjust order in more places --- django/db/backends/base/schema.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/django/db/backends/base/schema.py b/django/db/backends/base/schema.py index 65ab599858..41b7ea9bb6 100644 --- a/django/db/backends/base/schema.py +++ b/django/db/backends/base/schema.py @@ -366,8 +366,8 @@ class BaseDatabaseSchemaEditor: # Optionally add the tablespace if it's an implicitly indexed column. tablespace = ( field.db_tablespace - or settings.DATABASES[self.connection.alias].get("DEFAULT_TABLESPACE") or model._meta.db_tablespace + or settings.DATABASES[self.connection.alias].get("DEFAULT_TABLESPACE") ) if ( tablespace @@ -1533,10 +1533,10 @@ class BaseDatabaseSchemaEditor: db_tablespace = db_settings["DEFAULT_INDEX_TABLESPACE"] elif settings.DEFAULT_INDEX_TABLESPACE: db_tablespace = settings.DEFAULT_INDEX_TABLESPACE - elif db_settings.get("DEFAULT_TABLESPACE"): - db_tablespace = db_settings["DEFAULT_TABLESPACE"] elif model._meta.db_tablespace: db_tablespace = model._meta.db_tablespace + elif db_settings.get("DEFAULT_TABLESPACE"): + db_tablespace = db_settings["DEFAULT_TABLESPACE"] if db_tablespace is not None: return " " + self.connection.ops.tablespace_sql(db_tablespace) return ""