diff --git a/CHANGELOG.md b/CHANGELOG.md index c5a4ec680..55d10190b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ v2.6.1 (FUTURE) ## Bug Fixes * [#3275](https://github.com/digitalocean/netbox/issues/3275) - Fix error when adding power outlets to a device type +* [#3279](https://github.com/digitalocean/netbox/issues/3279) - Reset the PostgreSQL sequence for Tag and TaggedItem IDs --- diff --git a/netbox/extras/migrations/0023_fix_tag_sequences.py b/netbox/extras/migrations/0023_fix_tag_sequences.py new file mode 100644 index 000000000..faef5aa96 --- /dev/null +++ b/netbox/extras/migrations/0023_fix_tag_sequences.py @@ -0,0 +1,14 @@ +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('extras', '0022_custom_links'), + ] + + operations = [ + # Update the last_value for tag Tag and TaggedItem ID sequences + migrations.RunSQL("SELECT setval('extras_tag_id_seq', (SELECT id FROM extras_tag ORDER BY id DESC LIMIT 1) + 1)"), + migrations.RunSQL("SELECT setval('extras_taggeditem_id_seq', (SELECT id FROM extras_taggeditem ORDER BY id DESC LIMIT 1) + 1)"), + ]