ietf-tools / www

A customized CMS for the IETF website
BSD 3-Clause "New" or "Revised" License
25 stars 44 forks source link

chore: Merge conflicting snippets migrations and fix unique constraint #366

Closed mgax closed 9 months ago

mgax commented 9 months ago

Fixes https://github.com/ietf-tools/wagtail_website/issues/364.

Based on https://github.com/ietf-tools/wagtail_website/pull/365, this PR changes how the UNIQUE constraint is applied to the slug field. The initial code (currently in main) would create the field with the UNIQUE flag already set, before the data migration had a chance to generate values and populate the field, so all records had a value of "" (empty string), which failed the constraint.

The constraint, then, should be applied after the slugs are generated. Normally it's possible to add such constraints in the same migration, right after the RunPython step, but in this case, it triggers this bug: https://code.djangoproject.com/ticket/28646. That's why the unique flag is added in the 0004_merge_20231215_0352 migration.