-- +goose Up CREATE TABLE IF NOT EXISTS article_drafts ( id UUID PRIMARY KEY, article_id UUID NOT NULL REFERENCES articles(id) ON DELETE CASCADE, title TEXT NOT NULL DEFAULT '', sections_json JSONB NOT NULL DEFAULT '[]'::jsonb, client_saved_at TIMESTAMPTZ NOT NULL DEFAULT now(), created_at TIMESTAMPTZ NOT NULL DEFAULT now() ); CREATE INDEX IF NOT EXISTS idx_drafts_article_created ON article_drafts (article_id, created_at DESC); -- +goose Down DROP TABLE IF EXISTS article_drafts;