1
0
mirror of https://github.com/django/django.git synced 2025-04-03 13:06:49 +00:00

default to model meta tablespace, before using db options tablespace

This commit is contained in:
Ben Cail 2024-10-15 14:44:46 -04:00
parent df723f1a16
commit e77b7bb4b1

View File

@ -291,12 +291,12 @@ class BaseDatabaseSchemaEditor:
),
}
db_tablespace = None
if settings.DATABASES[self.connection.alias].get("DEFAULT_TABLESPACE"):
if model._meta.db_tablespace:
db_tablespace = model._meta.db_tablespace
elif settings.DATABASES[self.connection.alias].get("DEFAULT_TABLESPACE"):
db_tablespace = settings.DATABASES[self.connection.alias][
"DEFAULT_TABLESPACE"
]
elif model._meta.db_tablespace:
db_tablespace = model._meta.db_tablespace
if db_tablespace:
tablespace_sql = self.connection.ops.tablespace_sql(db_tablespace)
if tablespace_sql: