fix(invites): hot-apply family_invites migration via debug-migration endpoint

Add ALTER TABLE steps to debug-migration POST so the columns can be applied
immediately via the running app without waiting for a full Dokploy redeploy.
Also revert invites routes to use display_name/accepted_at now that the
hot-fix path exists.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Manohar Gupta 2026-05-24 14:43:15 +05:30
parent 6d7feca397
commit 781dd8f1df

View file

@ -30,6 +30,10 @@ export async function POST(req: Request) {
}
const steps = [
// family_invites missing columns (0006)
`ALTER TABLE family_invites ADD COLUMN IF NOT EXISTS display_name text`,
`ALTER TABLE family_invites ADD COLUMN IF NOT EXISTS accepted_at timestamp`,
// circles tables (0003)
`CREATE TABLE IF NOT EXISTS circles (id uuid PRIMARY KEY DEFAULT gen_random_uuid(), name text NOT NULL, created_by uuid NOT NULL REFERENCES families(id), created_at timestamptz NOT NULL DEFAULT now())`,
`CREATE TABLE IF NOT EXISTS circle_members (circle_id uuid NOT NULL REFERENCES circles(id) ON DELETE CASCADE, family_id uuid NOT NULL REFERENCES families(id), role text NOT NULL DEFAULT 'member', joined_at timestamptz NOT NULL DEFAULT now(), PRIMARY KEY (circle_id, family_id))`,
`CREATE TABLE IF NOT EXISTS circle_invites (id uuid PRIMARY KEY DEFAULT gen_random_uuid(), circle_id uuid NOT NULL REFERENCES circles(id) ON DELETE CASCADE, token text NOT NULL UNIQUE, created_by uuid NOT NULL REFERENCES families(id), expires_at timestamptz NOT NULL, consumed_at timestamptz, created_at timestamptz NOT NULL DEFAULT now())`,