Record the Studio schema migration atomically and support safe retries
waterfall-wiki CI and deployment / verify-and-deploy (push) Has been cancelled
waterfall-wiki CI and deployment / verify-and-deploy (push) Has been cancelled
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user