From 75410228dfd16e49eb3c0ea30b59b4c0d2ea6b03 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Wed, 15 Apr 2020 02:20:46 -0700 Subject: Fixed #31473 -- Made sql_flush() use RESTART IDENTITY to reset sequences on PostgreSQL. The sql_flush() positional argument sequences is replaced by the boolean keyword-only argument reset_sequences. This ensures that the old function signature can't be used by mistake when upgrading Django. When the new argument is True, the sequences of the truncated tables will reset. Using a single boolean value, rather than a list, allows making a binary yes/no choice as to whether to reset all sequences rather than a working on a completely different set. --- tests/backends/tests.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'tests/backends/tests.py') diff --git a/tests/backends/tests.py b/tests/backends/tests.py index f20d3db5f1..2cbfa2f5a2 100644 --- a/tests/backends/tests.py +++ b/tests/backends/tests.py @@ -161,13 +161,7 @@ class LongNameTest(TransactionTestCase): VLM._meta.db_table, VLM_m2m._meta.db_table, ] - sequences = [ - { - 'column': VLM._meta.pk.column, - 'table': VLM._meta.db_table - }, - ] - sql_list = connection.ops.sql_flush(no_style(), tables, sequences) + sql_list = connection.ops.sql_flush(no_style(), tables, reset_sequences=True) with connection.cursor() as cursor: for statement in sql_list: cursor.execute(statement) -- cgit v1.3