argos/dmp-db-scema/updates/00.01.041_add_ntf_Notificat...

34 lines
1.2 KiB
SQL

DO $$DECLARE
this_version CONSTANT varchar := '00.01.041';
BEGIN
PERFORM * FROM "DBVersion" WHERE version = this_version;
IF FOUND THEN RETURN; END IF;
CREATE TABLE public."ntf_NotificationTemplate"
(
id uuid NOT NULL,
channel smallint NOT NULL,
notification_type uuid NOT NULL,
kind smallint NOT NULL,
language uuid NOT NULL,
value text NOT NULL,
is_active smallint NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
tenant uuid,
CONSTRAINT "NotificationTemplate_pkey" PRIMARY KEY (id),
CONSTRAINT "NotificationTemplate_language_fkey" FOREIGN KEY (language)
REFERENCES public."Language" (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
NOT VALID,
CONSTRAINT "NotificationTemplate_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.041', '2023-12-15 12:00:00.000000+02', now(), 'Add ntf_NotificationTemplate table.');
END$$;