Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: multi dao orgs #320

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading