fix: ON UPDATE CASCADE on account FK so key rotation propagates

This commit is contained in:
M1 2026-03-16 15:58:52 +04:00
parent 0b69fbfc72
commit c73951ea91
1 changed files with 2 additions and 2 deletions

View File

@ -17,7 +17,7 @@ export async function migrate() {
await sql`
CREATE TABLE IF NOT EXISTS monitors (
id TEXT PRIMARY KEY DEFAULT gen_random_uuid()::text,
account_id TEXT NOT NULL REFERENCES accounts(id) ON DELETE CASCADE,
account_id TEXT NOT NULL REFERENCES accounts(id) ON DELETE CASCADE ON UPDATE CASCADE,
name TEXT NOT NULL,
url TEXT NOT NULL,
method TEXT NOT NULL DEFAULT 'GET',
@ -55,7 +55,7 @@ export async function migrate() {
await sql`
CREATE TABLE IF NOT EXISTS api_keys (
id TEXT PRIMARY KEY,
account_id TEXT NOT NULL REFERENCES accounts(id) ON DELETE CASCADE,
account_id TEXT NOT NULL REFERENCES accounts(id) ON DELETE CASCADE ON UPDATE CASCADE,
label TEXT NOT NULL,
created_at TIMESTAMPTZ DEFAULT now(),
last_used_at TIMESTAMPTZ