NGU-Web/server/src/migrations/053_us_spelling.sql
Zaldimmar 2ad65cdc15 Write the site in US English
color, center, canceled, labeled, recognize and the rest, in UI
text, help text, comments, docs and names (ColorInput, QrCenter).
Migration 053 renames the two Site settings color CHECKs, whose
names are the messages the admin shows. Kept: events.status's
stored value 'cancelled' (shown as canceled), aria-labelledby,
schema.org's EventCancelled, and old migrations as they ran.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 13:24:11 -05:00

34 lines
2 KiB
SQL

-- ═══════════════════════════════════════════════════════════════
-- 053 US SPELLING IN MESSAGES
--
-- The site is written in US English now. Two of 041's CHECKs are
-- named with the sentence the admin shows when a save breaks them
-- (admin-crud.js), and those said "colour"; the table is rebuilt to
-- rename them, the same columns and rows as before.
--
-- events.status keeps the value 'cancelled': it's stored data, and
-- the admin and the pages show it as "canceled".
-- ═══════════════════════════════════════════════════════════════
CREATE TABLE site_setting_colors_new (
id INTEGER PRIMARY KEY AUTOINCREMENT,
settings_id TEXT NOT NULL REFERENCES site_settings (id) ON DELETE CASCADE,
sort_order INTEGER NOT NULL DEFAULT 0,
token TEXT NOT NULL CHECK (token IN (
'ink', 'body', 'muted', 'link', 'brand', 'action', 'action-hover',
'surface', 'tint', 'tint-soft', 'danger', 'danger-tint')),
light TEXT CONSTRAINT "A color must be written #rrggbb, eg. #0f7183."
CHECK (light IS NULL OR (length(light) = 7 AND light GLOB '#[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]')),
dark TEXT CONSTRAINT "A dark color must be written #rrggbb, eg. #5ccbdc."
CHECK (dark IS NULL OR (length(dark) = 7 AND dark GLOB '#[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]')),
UNIQUE (settings_id, token)
) STRICT;
INSERT INTO site_setting_colors_new (id, settings_id, sort_order, token, light, dark)
SELECT id, settings_id, sort_order, token, light, dark
FROM site_setting_colors;
PRAGMA legacy_alter_table = ON;
DROP TABLE site_setting_colors;
ALTER TABLE site_setting_colors_new RENAME TO site_setting_colors;
PRAGMA legacy_alter_table = OFF;