Pre-launch — Gluecron is in final validation. Public signups and git hosting for non-owner users open after launch review.
CodeIssuesPull RequestsActionsSecurityInsightsSettings
✨ AI
More
Blame · Line-by-line history

0113_orgs_reconcile.sql

Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.

0113_orgs_reconcile.sqlBlame31 lines · 1 contributor
45ac593ccantynz-alt1-- Reconcile the `organizations` table with the code that writes to it.
2--
3-- Two Drizzle definitions both mapped to this one physical table:
4--
5-- src/db/schema.ts slug NOT NULL, created_by_id NOT NULL,
6-- billing_email — matches migration 0003, i.e.
7-- matches the real database.
8-- src/db/schema-extensions.ts display_name, website, location, is_verified,
9-- and NEITHER not-null column — describes a
10-- table this repo has never created.
11--
12-- drizzle.config.ts includes only schema.ts and deploys run db:migrate (never
13-- db:push), so schema-extensions has never been part of the migration
14-- pipeline. src/routes/orgs.tsx imports from schema-extensions, so
15-- POST /orgs/new inserted display_name/website (columns that do not exist)
16-- while omitting slug/created_by_id (NOT NULL, no default). Organization
17-- creation has therefore never succeeded — it fails on the first missing
18-- column every time.
19--
20-- Adding the columns rather than deleting the fields: the create form collects
21-- a display name and a website, and dropping them would silently discard what
22-- the user typed. All four are nullable (is_verified defaulted) so this is
23-- additive and safe to run against a populated table.
24
25ALTER TABLE "organizations" ADD COLUMN IF NOT EXISTS "display_name" text;
26--> statement-breakpoint
27ALTER TABLE "organizations" ADD COLUMN IF NOT EXISTS "website" text;
28--> statement-breakpoint
29ALTER TABLE "organizations" ADD COLUMN IF NOT EXISTS "location" text;
30--> statement-breakpoint
31ALTER TABLE "organizations" ADD COLUMN IF NOT EXISTS "is_verified" boolean DEFAULT false NOT NULL;