BUG: Reset collections id sequences
This commit is contained in:
parent
79e69001ec
commit
4a37d35694
1 changed files with 62 additions and 0 deletions
|
@ -0,0 +1,62 @@
|
|||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('collections_ccdb', '0003_DATA_fix_display_names'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunSQL(
|
||||
"SELECT setval('collections_ccdb_adfgpermit_id_seq', ("
|
||||
"SELECT MAX(id)+1 FROM collections_ccdb_adfgpermit), false)",
|
||||
|
||||
"SELECT setval('collections_ccdb_adfgpermit_id_seq', 1, false)"
|
||||
),
|
||||
|
||||
migrations.RunSQL(
|
||||
"SELECT setval('collections_ccdb_collection_id_seq', ("
|
||||
"SELECT MAX(id)+1 FROM collections_ccdb_collection), false)",
|
||||
|
||||
"SELECT setval('collections_ccdb_collection_id_seq', 1, false)"
|
||||
),
|
||||
|
||||
migrations.RunSQL(
|
||||
"SELECT setval('collections_ccdb_collectionmethod_id_seq', ("
|
||||
"SELECT MAX(id)+1 FROM collections_ccdb_collectionmethod), false)",
|
||||
|
||||
"SELECT setval('collections_ccdb_collectionmethod_id_seq', 1, "
|
||||
"false)"
|
||||
),
|
||||
|
||||
migrations.RunSQL(
|
||||
"SELECT setval('collections_ccdb_collectiontrap_id_seq', ("
|
||||
"SELECT MAX(id)+1 FROM collections_ccdb_collectiontrap), false)",
|
||||
|
||||
"SELECT setval('collections_ccdb_collectiontrap_id_seq', 1, false)"
|
||||
),
|
||||
|
||||
migrations.RunSQL(
|
||||
"SELECT setval('collections_ccdb_collectiontype_id_seq', ("
|
||||
"SELECT MAX(id)+1 FROM collections_ccdb_collectiontype), false)",
|
||||
|
||||
"SELECT setval('collections_ccdb_collectiontype_id_seq', 1, false)"
|
||||
),
|
||||
|
||||
migrations.RunSQL(
|
||||
"SELECT setval('collections_ccdb_datasheetattachment_id_seq', ("
|
||||
"SELECT MAX(id)+1 FROM collections_ccdb_datasheetattachment), "
|
||||
"false)",
|
||||
|
||||
"SELECT setval('collections_ccdb_datasheetattachment_id_seq', 1, "
|
||||
"false)"
|
||||
),
|
||||
|
||||
migrations.RunSQL(
|
||||
"SELECT setval('collections_ccdb_flaw_id_seq', ("
|
||||
"SELECT MAX(id)+1 FROM collections_ccdb_flaw), false)",
|
||||
|
||||
"SELECT setval('collections_ccdb_flaw_id_seq', 1, false)"
|
||||
),
|
||||
|
||||
]
|
Loading…
Add table
Reference in a new issue