fix(pwa): migration 010 boot failure on Postgres: no inline SQL comments

libsql-pg's convertDdl turns an inline '-- comment' inside CREATE TABLE into
a column named "--" (Postgres: column "--" specified more than once), which
crash-looped app.logicsrc.com on boot after #269. Comments move above the
statement, without semicolons (the migrator splits on them).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Anthony Ettinger 2026-10-29 04:38:26 +00:00
parent 0f237cb6e0
commit df9cd021ec
2 changed files with 20 additions and 12 deletions

View file

@ -6,21 +6,25 @@
-- rotate and how (dry run or approved, desktop host, propagate), and later the -- rotate and how (dry run or approved, desktop host, propagate), and later the
-- runner's per-key outcome (statuses, vault and site names, errors), never a -- runner's per-key outcome (statuses, vault and site names, errors), never a
-- value. Additive only. -- value. Additive only.
-- Columns: keys = JSON array of key names, approve 0 = dry run, options = JSON
-- {desktop?, propagate?, allowRoll?}, status queued|running|done|failed|cancelled,
-- claimed_by = api key id or user id of the runner, results = JSON per-key
-- outcomes (never values). No inline comments: the pg shim joins lines.
CREATE TABLE IF NOT EXISTS credshare_rotation_runs ( CREATE TABLE IF NOT EXISTS credshare_rotation_runs (
id TEXT PRIMARY KEY, id TEXT PRIMARY KEY,
team_id TEXT NOT NULL REFERENCES credshare_teams(id) ON DELETE CASCADE, team_id TEXT NOT NULL REFERENCES credshare_teams(id) ON DELETE CASCADE,
requested_by TEXT NOT NULL REFERENCES users(id), requested_by TEXT NOT NULL REFERENCES users(id),
keys TEXT NOT NULL, -- JSON array of key names keys TEXT NOT NULL,
project TEXT, project TEXT,
env TEXT, env TEXT,
approve bigint NOT NULL DEFAULT 0, -- 0 = dry run approve bigint NOT NULL DEFAULT 0,
options TEXT, -- JSON: { desktop?, propagate?, allowRoll? } options TEXT,
status TEXT NOT NULL DEFAULT 'queued', -- queued | running | done | failed | cancelled status TEXT NOT NULL DEFAULT 'queued',
claimed_by TEXT, -- api key id or user id of the runner claimed_by TEXT,
claimed_at bigint, claimed_at bigint,
finished_at bigint, finished_at bigint,
summary TEXT, summary TEXT,
results TEXT, -- JSON array of per-key results (never values) results TEXT,
created_at bigint NOT NULL created_at bigint NOT NULL
); );
CREATE INDEX IF NOT EXISTS idx_rotation_runs_team ON credshare_rotation_runs(team_id, status, created_at); CREATE INDEX IF NOT EXISTS idx_rotation_runs_team ON credshare_rotation_runs(team_id, status, created_at);

View file

@ -5,21 +5,25 @@
-- rotate and how (dry run or approved, desktop host, propagate), and later the -- rotate and how (dry run or approved, desktop host, propagate), and later the
-- runner's per-key outcome (statuses, vault and site names, errors), never a -- runner's per-key outcome (statuses, vault and site names, errors), never a
-- value. Additive only. -- value. Additive only.
-- Columns: keys = JSON array of key names, approve 0 = dry run, options = JSON
-- {desktop?, propagate?, allowRoll?}, status queued|running|done|failed|cancelled,
-- claimed_by = api key id or user id of the runner, results = JSON per-key
-- outcomes (never values). No inline comments: the pg shim joins lines.
CREATE TABLE IF NOT EXISTS credshare_rotation_runs ( CREATE TABLE IF NOT EXISTS credshare_rotation_runs (
id TEXT PRIMARY KEY, id TEXT PRIMARY KEY,
team_id TEXT NOT NULL REFERENCES credshare_teams(id) ON DELETE CASCADE, team_id TEXT NOT NULL REFERENCES credshare_teams(id) ON DELETE CASCADE,
requested_by TEXT NOT NULL REFERENCES users(id), requested_by TEXT NOT NULL REFERENCES users(id),
keys TEXT NOT NULL, -- JSON array of key names keys TEXT NOT NULL,
project TEXT, project TEXT,
env TEXT, env TEXT,
approve INTEGER NOT NULL DEFAULT 0, -- 0 = dry run approve INTEGER NOT NULL DEFAULT 0,
options TEXT, -- JSON: { desktop?, propagate?, allowRoll? } options TEXT,
status TEXT NOT NULL DEFAULT 'queued', -- queued | running | done | failed | cancelled status TEXT NOT NULL DEFAULT 'queued',
claimed_by TEXT, -- api key id or user id of the runner claimed_by TEXT,
claimed_at INTEGER, claimed_at INTEGER,
finished_at INTEGER, finished_at INTEGER,
summary TEXT, summary TEXT,
results TEXT, -- JSON array of per-key results (never values) results TEXT,
created_at INTEGER NOT NULL created_at INTEGER NOT NULL
); );
CREATE INDEX IF NOT EXISTS idx_rotation_runs_team ON credshare_rotation_runs(team_id, status, created_at); CREATE INDEX IF NOT EXISTS idx_rotation_runs_team ON credshare_rotation_runs(team_id, status, created_at);