1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #36052 -- Supported CompositePrimaryKey in inspectdb.

This commit is contained in:
Jacob Walls
2025-01-01 18:06:54 -05:00
committed by Sarah Boyce
parent ddefc3fed1
commit a8e4fd11ef
2 changed files with 11 additions and 10 deletions

View File

@@ -655,11 +655,10 @@ class InspectDBTransactionalTests(TransactionTestCase):
call_command("inspectdb", table_name, stdout=out)
output = out.getvalue()
self.assertIn(
f"column_1 = models.{field_type}(primary_key=True) # The composite "
f"primary key (column_1, column_2) found, that is not supported. The "
f"first column is selected.",
"pk = models.CompositePrimaryKey('column_1', 'column_2')",
output,
)
self.assertIn(f"column_1 = models.{field_type}()", output)
self.assertIn(
"column_2 = models.%s()"
% connection.features.introspected_field_types["IntegerField"],