mirror of
https://github.com/django/django.git
synced 2024-12-22 09:05:43 +00:00
Fixed #33773 -- Made Index with multiple fields respect DEFAULT_INDEX_TABLESPACE.
Thanks to Simon Charette for locating where issue lay.
This commit is contained in:
parent
4996eaa7b5
commit
de1c8320ce
@ -2,6 +2,7 @@ import logging
|
|||||||
import operator
|
import operator
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
from django.db.backends.ddl_references import (
|
from django.db.backends.ddl_references import (
|
||||||
Columns,
|
Columns,
|
||||||
Expressions,
|
Expressions,
|
||||||
@ -1306,6 +1307,8 @@ class BaseDatabaseSchemaEditor:
|
|||||||
if db_tablespace is None:
|
if db_tablespace is None:
|
||||||
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 settings.DEFAULT_INDEX_TABLESPACE:
|
||||||
|
db_tablespace = settings.DEFAULT_INDEX_TABLESPACE
|
||||||
elif model._meta.db_tablespace:
|
elif model._meta.db_tablespace:
|
||||||
db_tablespace = model._meta.db_tablespace
|
db_tablespace = model._meta.db_tablespace
|
||||||
if db_tablespace is not None:
|
if db_tablespace is not None:
|
||||||
|
@ -3,7 +3,7 @@ from unittest import mock
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import connection, models
|
from django.db import connection, models
|
||||||
from django.db.models.functions import Lower, Upper
|
from django.db.models.functions import Lower, Upper
|
||||||
from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature
|
from django.test import SimpleTestCase, TestCase, override_settings, skipUnlessDBFeature
|
||||||
from django.test.utils import isolate_apps
|
from django.test.utils import isolate_apps
|
||||||
|
|
||||||
from .models import Book, ChildModel1, ChildModel2
|
from .models import Book, ChildModel1, ChildModel2
|
||||||
@ -305,6 +305,7 @@ class SimpleIndexesTests(SimpleTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(DEFAULT_TABLESPACE=None)
|
||||||
class IndexesTests(TestCase):
|
class IndexesTests(TestCase):
|
||||||
@skipUnlessDBFeature("supports_tablespaces")
|
@skipUnlessDBFeature("supports_tablespaces")
|
||||||
def test_db_tablespace(self):
|
def test_db_tablespace(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user