2023-12-05 15:57:06 +01:00
|
|
|
DO $$DECLARE
|
2024-02-21 17:37:24 +01:00
|
|
|
this_version CONSTANT varchar := '00.01.040';
|
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_UserNotificationPreference"
|
2023-12-05 15:57:06 +01:00
|
|
|
(
|
2024-04-26 17:10:10 +02:00
|
|
|
id uuid NOT NULL,
|
2023-12-05 15:57:06 +01:00
|
|
|
"user" uuid NOT NULL,
|
2024-01-24 16:49:50 +01:00
|
|
|
"type" uuid NOT NULL,
|
|
|
|
"channel" smallint NOT NULL,
|
|
|
|
"ordinal" numeric NOT NULL,
|
2024-04-26 17:10:10 +02:00
|
|
|
"tenant" uuid NULL,
|
2024-01-25 11:28:21 +01:00
|
|
|
"created_at" timestamp without time zone NOT NULL,
|
|
|
|
"updated_at" timestamp without time zone NOT NULL,
|
|
|
|
"is_active" smallint NOT NULL DEFAULT 1,
|
2024-04-26 17:10:10 +02:00
|
|
|
CONSTRAINT "ntf_UserNotificationPreference_pkey" PRIMARY KEY (id),
|
2024-01-24 16:49:50 +01:00
|
|
|
CONSTRAINT "ntf_UserNotificationPreference_tenant_fkey" FOREIGN KEY ("tenant")
|
|
|
|
REFERENCES public."ntf_Tenant" (id) MATCH SIMPLE
|
2023-12-05 15:57:06 +01:00
|
|
|
ON UPDATE NO ACTION
|
2023-12-06 10:34:24 +01:00
|
|
|
ON DELETE NO ACTION,
|
|
|
|
CONSTRAINT "ntf_UserNotificationPreference_user_fkey" FOREIGN KEY ("user")
|
2024-01-24 16:49:50 +01:00
|
|
|
REFERENCES public."ntf_User" (id) MATCH SIMPLE
|
2023-12-05 15:57:06 +01:00
|
|
|
ON UPDATE NO ACTION
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
);
|
|
|
|
|
2024-02-21 17:37:24 +01:00
|
|
|
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.040', '2023-12-05 12:00:00.000000+02', now(), 'Add table ntf_UserNotificationPreference.');
|
2023-12-05 15:57:06 +01:00
|
|
|
|
|
|
|
END$$;
|