mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
5af7d211c8
https://community.openproject.org/wp/74977 Add NOT NULL to *sluggable_type* and fix NULL *scope* uniqueness in *friendly_id_slugs* - Delete duplicate NULL *scope* rows, keeping the most recent per (slug, sluggable_type) - Delete NULL *sluggable_type* rows before adding NOT NULL constraint - Replace unique index on (slug, sluggable_type, scope) with NULLS NOT DISTINCT variant (requires Postgres 15+) Why? 1. *sluggable_type* NOT NULL every slug must belong to a model (e.g. Post, User). A slug with no *sluggable_type* is orphaned and meaningless. 2. NULLS NOT DISTINCT in the unique constraint not treating every NULL *scope* as unique leads to duplicate records if *scope* is NULL which does not make sense and pollutes the table with unnecessary data