Skip to content

Commit

Permalink
feat: adds extention for orgs vs daos, colors
Browse files Browse the repository at this point in the history
  • Loading branch information
R-K-H committed Nov 19, 2024
1 parent 569114e commit 96cd68b
Show file tree
Hide file tree
Showing 8 changed files with 5,230 additions and 23 deletions.
Binary file added bun.lockb
Binary file not shown.
Binary file added packages/database/bun.lockb
Binary file not shown.
34 changes: 34 additions & 0 deletions packages/database/drizzle/0010_crazy_sentinels.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
CREATE TABLE IF NOT EXISTS "organizations" (
"organization_id" bigserial PRIMARY KEY NOT NULL,
"name" text NOT NULL,
"slug" varchar,
"url" varchar,
"description" text,
"image_url" varchar,
"creator_acct" varchar(44),
"admin_accts" jsonb,
"is_hide" boolean,
"socials" jsonb,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
CONSTRAINT "organizations_name_unique" UNIQUE("name"),
CONSTRAINT "organizations_slug_unique" UNIQUE("slug"),
CONSTRAINT "organizations_url_unique" UNIQUE("url")
-- CONSTRAINT "id_name_url" UNIQUE("organization_id","url","name")
);
--> statement-breakpoint
ALTER TABLE "dao_details" ADD COLUMN "organization_id" bigint;--> statement-breakpoint
ALTER TABLE "daos" ADD COLUMN "is_active" boolean DEFAULT false NOT NULL;--> statement-breakpoint
ALTER TABLE "daos" ADD COLUMN "is_primary" boolean DEFAULT false NOT NULL;--> statement-breakpoint
ALTER TABLE "daos" ADD COLUMN "organization_id" bigint;--> statement-breakpoint
ALTER TABLE "daos" ADD COLUMN "colors" jsonb;--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "dao_details" ADD CONSTRAINT "dao_details_organization_id_organizations_organization_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organizations"("organization_id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "daos" ADD CONSTRAINT "daos_organization_id_organizations_organization_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organizations"("organization_id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
Loading

0 comments on commit 96cd68b

Please sign in to comment.