1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

[5.2.x] Fixed #36357 -- Skipped unique_together in inspectdb output for composite primary keys.

Thanks to Baptiste Mispelon for the report and quick fix, and to Simon
Charette and Jacob Walls for the reviews.

Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>

Backport of 66f9eb0ff1 from main.
This commit is contained in:
Baptiste Mispelon
2025-04-28 09:48:12 +02:00
committed by Natalia
parent ec73fd6746
commit 1367a197dd
3 changed files with 10 additions and 1 deletions

View File

@@ -637,3 +637,8 @@ class InspectDBTransactionalTests(TransactionTestCase):
)
self.assertIn(f"column_1 = models.{field_type}()", output)
self.assertIn(f"column_2 = models.{field_type}()", output)
def test_composite_primary_key_not_unique_together(self):
out = StringIO()
call_command("inspectdb", "inspectdb_compositeprimarykeymodel", stdout=out)
self.assertNotIn("unique_together", out.getvalue())