CREATE TABLE "portal_dashboard_layout" ( "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, "user_id" text NOT NULL, "portal_view_id" uuid NOT NULL, "layouts" jsonb DEFAULT '{}'::jsonb NOT NULL, "created_at" timestamp with time zone DEFAULT now() NOT NULL, "updated_at" timestamp with time zone DEFAULT now() NOT NULL ); --> statement-breakpoint CREATE TABLE "profile_image" ( "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, "user_id" text NOT NULL, "content_type" text NOT NULL, "data_base64" text NOT NULL, "byte_size" integer NOT NULL, "created_at" timestamp with time zone DEFAULT now() NOT NULL, "updated_at" timestamp with time zone DEFAULT now() NOT NULL ); --> statement-breakpoint ALTER TABLE "portal_dashboard_layout" ADD CONSTRAINT "portal_dashboard_layout_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint ALTER TABLE "portal_dashboard_layout" ADD CONSTRAINT "portal_dashboard_layout_portal_view_id_portal_view_id_fk" FOREIGN KEY ("portal_view_id") REFERENCES "public"."portal_view"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint ALTER TABLE "profile_image" ADD CONSTRAINT "profile_image_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint CREATE UNIQUE INDEX "portal_dashboard_layout_user_view_unique" ON "portal_dashboard_layout" USING btree ("user_id","portal_view_id");--> statement-breakpoint CREATE INDEX "portal_dashboard_layout_user_idx" ON "portal_dashboard_layout" USING btree ("user_id");--> statement-breakpoint CREATE UNIQUE INDEX "profile_image_user_unique" ON "profile_image" USING btree ("user_id");