Files
property-management-network/lib/db/migrations/0002_quiet_freak.sql
T

20 lines
1.3 KiB
SQL
Raw Normal View History

CREATE TABLE "account_members" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"owner_id" text NOT NULL,
"member_id" text,
"email" text NOT NULL,
"role" text DEFAULT 'member' NOT NULL,
"status" text DEFAULT 'pending' NOT NULL,
"invite_token" text DEFAULT gen_random_uuid()::text NOT NULL,
"accepted_at" timestamp with time zone,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
CONSTRAINT "account_members_invite_token_unique" UNIQUE("invite_token")
);
--> statement-breakpoint
ALTER TABLE "profiles" ADD COLUMN "brand_name" text;--> statement-breakpoint
ALTER TABLE "profiles" ADD COLUMN "brand_logo_url" text;--> statement-breakpoint
ALTER TABLE "profiles" ADD COLUMN "brand_color" text;--> statement-breakpoint
ALTER TABLE "profiles" ADD COLUMN "hide_powered_by" boolean DEFAULT false NOT NULL;--> statement-breakpoint
ALTER TABLE "account_members" ADD CONSTRAINT "account_members_owner_id_profiles_id_fk" FOREIGN KEY ("owner_id") REFERENCES "public"."profiles"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "account_members" ADD CONSTRAINT "account_members_member_id_profiles_id_fk" FOREIGN KEY ("member_id") REFERENCES "public"."profiles"("id") ON DELETE cascade ON UPDATE no action;