diff options
| author | Simon Charette <charette.s@gmail.com> | 2025-04-28 22:46:13 -0400 |
|---|---|---|
| committer | Natalia <124304+nessita@users.noreply.github.com> | 2025-04-30 10:53:39 -0300 |
| commit | 5d03c71b7a2256e776f134a7844c95f0f8f06c6d (patch) | |
| tree | 68ef28f72f3f1f2d3972ef80f5cdefa38e24b55e /django | |
| parent | 7f6a5fbe2ef26d9970508d5a7236fe009ec274d0 (diff) | |
[5.2.x] Refs #36052, #32234 -- Removed create_test_table_with_composite_primary_key flag in favor of using CompositePrimaryKey.
Now that Django properly supports creating models with composite primary
keys, the tests should use a `CompositePrimaryKey` field instead of a
feature flag to inline backend specific SQL for creating a composite PK.
Specifcially, the inspectdb's test_composite_primary_key was adjusted to
use schema editor instead of per-backend raw SQL.
Backport of 4c75858135589f3a00e32eb4d476074536371a32 from main.
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/backends/base/features.py | 4 | ||||
| -rw-r--r-- | django/db/backends/mysql/features.py | 7 | ||||
| -rw-r--r-- | django/db/backends/oracle/features.py | 7 | ||||
| -rw-r--r-- | django/db/backends/postgresql/features.py | 7 | ||||
| -rw-r--r-- | django/db/backends/sqlite3/features.py | 7 |
5 files changed, 0 insertions, 32 deletions
diff --git a/django/db/backends/base/features.py b/django/db/backends/base/features.py index 0f8e6f41a6..de5dc12768 100644 --- a/django/db/backends/base/features.py +++ b/django/db/backends/base/features.py @@ -278,10 +278,6 @@ class BaseDatabaseFeatures: create_test_procedure_without_params_sql = None create_test_procedure_with_int_param_sql = None - # SQL to create a table with a composite primary key for use by the Django - # test suite. - create_test_table_with_composite_primary_key = None - # Does the backend support keyword parameters for cursor.callproc()? supports_callproc_kwargs = False diff --git a/django/db/backends/mysql/features.py b/django/db/backends/mysql/features.py index 414f552d94..6daf4cfbca 100644 --- a/django/db/backends/mysql/features.py +++ b/django/db/backends/mysql/features.py @@ -41,13 +41,6 @@ class DatabaseFeatures(BaseDatabaseFeatures): SET V_I = P_I; END; """ - create_test_table_with_composite_primary_key = """ - CREATE TABLE test_table_composite_pk ( - column_1 INTEGER NOT NULL, - column_2 INTEGER NOT NULL, - PRIMARY KEY(column_1, column_2) - ) - """ # Neither MySQL nor MariaDB support partial indexes. supports_partial_indexes = False # COLLATE must be wrapped in parentheses because MySQL treats COLLATE as an diff --git a/django/db/backends/oracle/features.py b/django/db/backends/oracle/features.py index 7ebe69c6dd..20fa1673d5 100644 --- a/django/db/backends/oracle/features.py +++ b/django/db/backends/oracle/features.py @@ -60,13 +60,6 @@ class DatabaseFeatures(BaseDatabaseFeatures): V_I := P_I; END; """ - create_test_table_with_composite_primary_key = """ - CREATE TABLE test_table_composite_pk ( - column_1 NUMBER(11) NOT NULL, - column_2 NUMBER(11) NOT NULL, - PRIMARY KEY (column_1, column_2) - ) - """ supports_callproc_kwargs = True supports_over_clause = True supports_frame_range_fixed_distance = True diff --git a/django/db/backends/postgresql/features.py b/django/db/backends/postgresql/features.py index 16653a0519..06240bdf62 100644 --- a/django/db/backends/postgresql/features.py +++ b/django/db/backends/postgresql/features.py @@ -52,13 +52,6 @@ class DatabaseFeatures(BaseDatabaseFeatures): V_I := P_I; END; $$ LANGUAGE plpgsql;""" - create_test_table_with_composite_primary_key = """ - CREATE TABLE test_table_composite_pk ( - column_1 INTEGER NOT NULL, - column_2 INTEGER NOT NULL, - PRIMARY KEY(column_1, column_2) - ) - """ requires_casted_case_in_updates = True supports_over_clause = True supports_frame_exclusion = True diff --git a/django/db/backends/sqlite3/features.py b/django/db/backends/sqlite3/features.py index 6ab6308ece..61e6eff13d 100644 --- a/django/db/backends/sqlite3/features.py +++ b/django/db/backends/sqlite3/features.py @@ -51,13 +51,6 @@ class DatabaseFeatures(BaseDatabaseFeatures): # Date/DateTime fields and timedeltas. "expressions.tests.FTimeDeltaTests.test_mixed_comparisons1", } - create_test_table_with_composite_primary_key = """ - CREATE TABLE test_table_composite_pk ( - column_1 INTEGER NOT NULL, - column_2 INTEGER NOT NULL, - PRIMARY KEY(column_1, column_2) - ) - """ insert_test_table_with_defaults = 'INSERT INTO {} ("null") VALUES (1)' supports_default_keyword_in_insert = False supports_unlimited_charfield = True |
