2023-12-05 15:57:06 +01:00
|
|
|
DO $$DECLARE
|
2024-02-21 17:37:24 +01:00
|
|
|
this_version CONSTANT varchar := '00.01.039';
|
2023-12-05 15:57:06 +01:00
|
|
|
BEGIN
|
|
|
|
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
|
|
|
IF FOUND THEN RETURN; END IF;
|
|
|
|
|
2023-12-06 10:34:24 +01:00
|
|
|
CREATE TABLE public."ntf_InAppNotification"
|
2023-12-05 15:57:06 +01:00
|
|
|
(
|
|
|
|
id uuid NOT NULL,
|
|
|
|
"user" uuid NOT NULL,
|
|
|
|
type uuid NOT NULL,
|
|
|
|
read_time timestamp without time zone,
|
|
|
|
tracking_state smallint NOT NULL,
|
|
|
|
priority smallint NOT NULL,
|
2023-12-06 10:34:24 +01:00
|
|
|
subject character varying COLLATE pg_catalog."default",
|
|
|
|
body character varying COLLATE pg_catalog."default",
|
|
|
|
extra_data character varying COLLATE pg_catalog."default",
|
2023-12-05 15:57:06 +01:00
|
|
|
created_at timestamp without time zone NOT NULL,
|
|
|
|
updated_at timestamp without time zone NOT NULL,
|
|
|
|
tenant uuid,
|
2023-12-06 10:34:24 +01:00
|
|
|
is_active smallint NOT NULL,
|
|
|
|
CONSTRAINT "ntf_InAppNotification_pkey" PRIMARY KEY (id),
|
|
|
|
CONSTRAINT "ntf_InAppNotification_tenant_fkey" FOREIGN KEY (tenant)
|
2023-12-05 15:57:06 +01:00
|
|
|
REFERENCES public."Tenant" (id) MATCH SIMPLE
|
|
|
|
ON UPDATE NO ACTION
|
2023-12-06 10:34:24 +01:00
|
|
|
ON DELETE NO ACTION,
|
|
|
|
CONSTRAINT "ntf_InAppNotification_user_fkey" FOREIGN KEY ("user")
|
2023-12-05 15:57:06 +01:00
|
|
|
REFERENCES public."User" (id) MATCH SIMPLE
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
);
|
|
|
|
|
2024-02-21 17:37:24 +01:00
|
|
|
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.039', '2023-12-05 12:00:00.000000+02', now(), 'Add table ntf_InAppNotification.');
|
2023-12-05 15:57:06 +01:00
|
|
|
|
|
|
|
END$$;
|