1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

adjust order in more places

This commit is contained in:
Ben Cail 2024-10-15 15:14:31 -04:00
parent e77b7bb4b1
commit 2166f4b077

View File

@ -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 ""