mirror of
https://github.com/django/django.git
synced 2025-06-16 00:49:12 +00:00
assume OPTIONS is always in DATABASES[alias]
This commit is contained in:
parent
cd5bb1ea4a
commit
aa93853c5d
@ -291,10 +291,8 @@ class BaseDatabaseSchemaEditor:
|
|||||||
),
|
),
|
||||||
}
|
}
|
||||||
db_tablespace = None
|
db_tablespace = None
|
||||||
if (
|
if settings.DATABASES[self.connection.alias]["OPTIONS"].get(
|
||||||
settings.DATABASES[self.connection.alias]
|
"DEFAULT_TABLESPACE"
|
||||||
.get("OPTIONS", {})
|
|
||||||
.get("DEFAULT_TABLESPACE")
|
|
||||||
):
|
):
|
||||||
db_tablespace = settings.DATABASES[self.connection.alias]["OPTIONS"][
|
db_tablespace = settings.DATABASES[self.connection.alias]["OPTIONS"][
|
||||||
"DEFAULT_TABLESPACE"
|
"DEFAULT_TABLESPACE"
|
||||||
@ -370,9 +368,9 @@ class BaseDatabaseSchemaEditor:
|
|||||||
# Optionally add the tablespace if it's an implicitly indexed column.
|
# Optionally add the tablespace if it's an implicitly indexed column.
|
||||||
tablespace = (
|
tablespace = (
|
||||||
field.db_tablespace
|
field.db_tablespace
|
||||||
or settings.DATABASES[self.connection.alias]
|
or settings.DATABASES[self.connection.alias]["OPTIONS"].get(
|
||||||
.get("OPTIONS", {})
|
"DEFAULT_TABLESPACE"
|
||||||
.get("DEFAULT_TABLESPACE")
|
)
|
||||||
or model._meta.db_tablespace
|
or model._meta.db_tablespace
|
||||||
)
|
)
|
||||||
if (
|
if (
|
||||||
@ -1532,7 +1530,7 @@ class BaseDatabaseSchemaEditor:
|
|||||||
|
|
||||||
def _get_index_tablespace_sql(self, model, fields, db_tablespace=None):
|
def _get_index_tablespace_sql(self, model, fields, db_tablespace=None):
|
||||||
if db_tablespace is None:
|
if db_tablespace is None:
|
||||||
db_options = settings.DATABASES[self.connection.alias].get("OPTIONS", {})
|
db_options = settings.DATABASES[self.connection.alias]["OPTIONS"]
|
||||||
if len(fields) == 1 and fields[0].db_tablespace:
|
if len(fields) == 1 and fields[0].db_tablespace:
|
||||||
db_tablespace = fields[0].db_tablespace
|
db_tablespace = fields[0].db_tablespace
|
||||||
elif db_options.get("DEFAULT_INDEX_TABLESPACE"):
|
elif db_options.get("DEFAULT_INDEX_TABLESPACE"):
|
||||||
|
@ -924,9 +924,9 @@ class Field(RegisterLookupMixin):
|
|||||||
def db_tablespace(self):
|
def db_tablespace(self):
|
||||||
return (
|
return (
|
||||||
self._db_tablespace
|
self._db_tablespace
|
||||||
or settings.DATABASES[connection.alias]
|
or settings.DATABASES[connection.alias]["OPTIONS"].get(
|
||||||
.get("OPTIONS", {})
|
"DEFAULT_INDEX_TABLESPACE"
|
||||||
.get("DEFAULT_INDEX_TABLESPACE")
|
)
|
||||||
or settings.DEFAULT_INDEX_TABLESPACE
|
or settings.DEFAULT_INDEX_TABLESPACE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user