CREATE TABLE "email_preferences" ( "user_id" uuid NOT NULL, "workflow" varchar(64) NOT NULL, "opted_out" boolean DEFAULT true NOT NULL, "source" varchar(32) 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 "email_preferences" ADD CONSTRAINT "email_preferences_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint CREATE UNIQUE INDEX "email_preferences_pk" ON "email_preferences" USING btree ("user_id","workflow");--> statement-breakpoint CREATE INDEX "email_preferences_workflow_idx" ON "email_preferences" USING btree ("workflow");