argos/dmp-db-scema/updates/00.01.040_addActionConfirma...

35 lines
1.3 KiB
MySQL
Raw Normal View History

DO $$DECLARE
this_version CONSTANT varchar := '00.01.040';
BEGIN
PERFORM * FROM "DBVersion" WHERE version = this_version;
IF FOUND THEN RETURN; END IF;
CREATE TABLE public."ActionConfirmation"
(
id uuid NOT NULL,
type smallint NOT NULL,
status smallint NOT NULL,
token character varying NOT NULL,
data text NOT NULL,
expires_at timestamp without time zone NOT NULL,
created_by uuid NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
is_active smallint NOT NULL,
tenant uuid,
CONSTRAINT "ActionConfirmation_pkey" PRIMARY KEY (id),
CONSTRAINT "ActionConfirmation_created_by_fkey" FOREIGN KEY (created_by)
REFERENCES public."User" (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
NOT VALID,
CONSTRAINT "ActionConfirmation_tenant_fkey" FOREIGN KEY (tenant)
REFERENCES public."Tenant" (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
NOT VALID
);
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.040', '2023-12-13 12:00:00.000000+02', now(), 'Add ActionConfirmation table.');
END$$;