2023-12-05 15:57:06 +01:00
|
|
|
DO $$DECLARE
|
|
|
|
this_version CONSTANT varchar := '00.01.034';
|
|
|
|
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_UserNotificationPreference"
|
2023-12-05 15:57:06 +01:00
|
|
|
(
|
|
|
|
"user" uuid NOT NULL,
|
|
|
|
type uuid NOT NULL,
|
|
|
|
channel smallint NOT NULL,
|
|
|
|
ordinal numeric NOT NULL,
|
|
|
|
created_at timestamp without time zone NOT NULL,
|
|
|
|
tenant uuid,
|
2023-12-06 10:34:24 +01:00
|
|
|
CONSTRAINT "ntf_UserNotificationPreference_pkey" PRIMARY KEY ("user", type, channel),
|
|
|
|
CONSTRAINT "ntf_UserNotificationPreference_tennant_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_UserNotificationPreference_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
|
|
|
|
);
|
|
|
|
|
2023-12-06 10:34:24 +01:00
|
|
|
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.034', '2023-12-05 12:00:00.000000+02', now(), 'Add table ntf_UserNotificationPreference.');
|
2023-12-05 15:57:06 +01:00
|
|
|
|
|
|
|
END$$;
|