You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
senzapaura_es/drizzle/0024_intenciones_pago.sql

13 lines
734 B

CREATE TABLE "intencion_pago" (
"id" text PRIMARY KEY NOT NULL,
"usuario_id" text NOT NULL,
"huella" text NOT NULL,
"datos" jsonb NOT NULL,
"sesion_pago_id" text,
"estado" text DEFAULT 'abierta' NOT NULL,
"creado_en" timestamp with time zone DEFAULT now() NOT NULL,
CONSTRAINT "intencion_pago_sesion_pago_id_unique" UNIQUE("sesion_pago_id")
);
--> statement-breakpoint
ALTER TABLE "intencion_pago" ADD CONSTRAINT "intencion_pago_usuario_id_usuario_id_fk" FOREIGN KEY ("usuario_id") REFERENCES "public"."usuario"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
CREATE UNIQUE INDEX "intencion_pago_abierta" ON "intencion_pago" USING btree ("usuario_id","huella") WHERE "intencion_pago"."estado" = 'abierta';

Powered by TurnKey Linux.