Record the Studio schema migration atomically and support safe retries
waterfall-wiki CI and deployment / verify-and-deploy (push) Has been cancelled

This commit is contained in:
2026-10-27 15:56:28 +08:00
parent 054e993043
commit 5427df8ff3
2 changed files with 6 additions and 2 deletions
@@ -1,4 +1,5 @@
CREATE TABLE studio_designs (
BEGIN;
CREATE TABLE IF NOT EXISTS studio_designs (
id uuid PRIMARY KEY,
layout_id text NOT NULL CHECK (layout_id ~ '^ref-(0[1-9]|1[0-9]|2[0-7])$'),
name text NOT NULL CHECK (char_length(name) BETWEEN 1 AND 120),
@@ -7,4 +8,6 @@ CREATE TABLE studio_designs (
created_at timestamptz NOT NULL DEFAULT now(),
updated_at timestamptz NOT NULL DEFAULT now()
);
CREATE INDEX studio_designs_layout_created ON studio_designs(layout_id,created_at DESC,id DESC);
CREATE INDEX IF NOT EXISTS studio_designs_layout_created ON studio_designs(layout_id,created_at DESC,id DESC);
INSERT INTO schema_migrations(version) VALUES('009_studio_designs');
COMMIT;