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

35 lines
1.3 KiB
MySQL
Raw Permalink Normal View History

DO $$DECLARE
2024-02-21 17:37:24 +01:00
this_version CONSTANT varchar := '00.01.045';
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
);
2024-02-21 17:37:24 +01:00
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.045', '2023-12-13 12:00:00.000000+02', now(), 'Add ActionConfirmation table.');
END$$;