| 12345678910111213141516171819 |
- CREATE TABLE "project_invitations" (
- "id" text PRIMARY KEY NOT NULL,
- "project_id" text NOT NULL,
- "email" text NOT NULL,
- "role" text DEFAULT 'developer' NOT NULL,
- "token_hash" text NOT NULL,
- "invited_by" text,
- "expires_at" timestamp with time zone NOT NULL,
- "accepted_at" timestamp with time zone,
- "revoked_at" timestamp with time zone,
- "created_at" timestamp with time zone DEFAULT now() NOT NULL
- );
- --> statement-breakpoint
- ALTER TABLE "users" ADD COLUMN "is_admin" boolean DEFAULT false NOT NULL;--> statement-breakpoint
- ALTER TABLE "users" ADD COLUMN "suspended_at" timestamp with time zone;--> statement-breakpoint
- ALTER TABLE "project_invitations" ADD CONSTRAINT "project_invitations_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
- ALTER TABLE "project_invitations" ADD CONSTRAINT "project_invitations_invited_by_users_id_fk" FOREIGN KEY ("invited_by") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
- CREATE UNIQUE INDEX "project_invitations_project_email_idx" ON "project_invitations" USING btree ("project_id","email");--> statement-breakpoint
- CREATE UNIQUE INDEX "project_invitations_token_idx" ON "project_invitations" USING btree ("token_hash");
|