From bf091102f2d0daabd07bb866f22bffff92284cd2 Mon Sep 17 00:00:00 2001 From: Lucas Berger Date: Thu, 11 Jun 2026 19:27:11 -0400 Subject: [PATCH] fix(08-fix): IN-01 document MariaDB-only long-unique HASH index dependency --- apps/api/src/db/migrations/0000_baseline.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apps/api/src/db/migrations/0000_baseline.sql b/apps/api/src/db/migrations/0000_baseline.sql index d239477..c79b19b 100644 --- a/apps/api/src/db/migrations/0000_baseline.sql +++ b/apps/api/src/db/migrations/0000_baseline.sql @@ -45,6 +45,11 @@ CREATE TABLE `calendars` ( `last_synced_at` timestamp, `is_shared` boolean NOT NULL DEFAULT false, CONSTRAINT `calendars_id` PRIMARY KEY(`id`), + -- NOTE (IN-01): UNIQUE(user_id, url) with url varchar(1024)/utf8mb4 is ~4100 bytes, + -- over InnoDB's 3072-byte index-key limit. Succeeds only because MariaDB 11 silently + -- builds over-length UNIQUE constraints as long-unique HASH indexes; this same DDL + -- fails on MySQL 8 or with stricter SQL modes. Engine-pinned to MariaDB (project hard + -- constraint). Already applied on main/production — do not alter. CONSTRAINT `uniq_calendar_user_url` UNIQUE(`user_id`,`url`) ); --> statement-breakpoint @@ -97,6 +102,11 @@ CREATE TABLE `push_subscriptions` ( `created_at` timestamp NOT NULL DEFAULT (now()), `updated_at` timestamp DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP, CONSTRAINT `push_subscriptions_id` PRIMARY KEY(`id`), + -- NOTE (IN-01): UNIQUE(endpoint) with endpoint varchar(2048)/utf8mb4 is ~8192 bytes, + -- over InnoDB's 3072-byte index-key limit. Succeeds only because MariaDB 11 silently + -- builds over-length UNIQUE constraints as long-unique HASH indexes; this same DDL + -- fails on MySQL 8 or with stricter SQL modes. Engine-pinned to MariaDB (project hard + -- constraint). Already applied on main/production — do not alter. CONSTRAINT `uniq_push_endpoint` UNIQUE(`endpoint`) ); --> statement-breakpoint