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