fix(migration): deduplicate languages before LOWER() in 025_lowercase_languages.sql

Two rows (Néerlandais id=5, néerlandais id=3) collided when lowercased,
violating the UNIQUE constraint on languages.name.

Added DELETE to keep the lowest-ID row per LOWER(name) group before
the UPDATE SET name = LOWER(name).
This commit is contained in:
Pontoporeia
2026-06-08 09:48:51 +02:00
parent f4cb06656e
commit 053f09b181
2 changed files with 9 additions and 0 deletions

View File

@@ -4,3 +4,4 @@
- [x] Fix `ShareLink::setPassword()`: also encrypt and store plain-text password, matching `create()` behavior - [x] Fix `ShareLink::setPassword()`: also encrypt and store plain-text password, matching `create()` behavior
- [x] Audit: confirm all remaining credential comparison sites use constant-time `hash_equals` or `password_verify` - [x] Audit: confirm all remaining credential comparison sites use constant-time `hash_equals` or `password_verify`
- [x] Fix `.gitignore`: anchor `vendor/` to root (`/vendor/`) so `app/public/assets/js/vendor/` (htmx, OverType, FilePond) is tracked - [x] Fix `.gitignore`: anchor `vendor/` to root (`/vendor/`) so `app/public/assets/js/vendor/` (htmx, OverType, FilePond) is tracked
- [x] Fix migration `025_lowercase_languages.sql`: deduplicate languages before LOWER() to avoid UNIQUE constraint violation (`Néerlandais`/`néerlandais`)

View File

@@ -1,6 +1,14 @@
-- 025_lowercase_languages.sql -- 025_lowercase_languages.sql
-- Normalise les noms de langues en minuscules et recrée la vue avec ucfirst. -- Normalise les noms de langues en minuscules et recrée la vue avec ucfirst.
-- Supprimer les doublons (même nom après LOWER) en gardant l'id le plus petit
DELETE FROM languages
WHERE id NOT IN (
SELECT MIN(id)
FROM languages
GROUP BY LOWER(name)
);
-- Normaliser les langues existantes -- Normaliser les langues existantes
UPDATE languages SET name = LOWER(name); UPDATE languages SET name = LOWER(name);