fix: database unique constraints (#2594)

* fixed missing migration name

* added unique constraints to all m2m tables

* fixed bug trying to create duplicate tags

* added more unique constraints

* fixed duplicate seeder data

* updated tests

* fixed seed rollback error
This commit is contained in:
Michael Genson
2023-10-07 14:23:13 -05:00
committed by GitHub
parent 247a4de283
commit a98e863bca
13 changed files with 222 additions and 15 deletions

View File

@@ -33,8 +33,13 @@ class ScrapedExtras:
repo = ctx.repos.tags.by_group(ctx.group_id)
tags = []
seen_tag_slugs: set[str] = set()
for tag in self._tags:
slugify_tag = slugify(tag)
if slugify_tag in seen_tag_slugs:
continue
seen_tag_slugs.add(slugify_tag)
# Check if tag exists
if db_tag := repo.get_one(slugify_tag, "slug"):