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

40 lines
1.5 KiB
SQL

DO $$DECLARE
this_version CONSTANT varchar := '00.01.028';
BEGIN
PERFORM * FROM "DBVersion" WHERE version = this_version;
IF FOUND THEN RETURN; END IF;
CREATE TABLE public."ntf_Notification"
(
id uuid NOT NULL,
"user" uuid,
tenant uuid,
type uuid,
contact_hint character varying(200) COLLATE pg_catalog."default",
notified_at timestamp without time zone,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
data text COLLATE pg_catalog."default",
retry_count integer,
tracking_data text COLLATE pg_catalog."default",
provenance_ref character varying(200) COLLATE pg_catalog."default",
tracking_state smallint NOT NULL,
tracking_process smallint NOT NULL,
is_active smallint NOT NULL,
contact_type_hint smallint,
notify_state smallint,
notified_with smallint,
CONSTRAINT "ntf_Notification_pkey" PRIMARY KEY (id),
CONSTRAINT "ntf_Notification_tenant_fkey" FOREIGN KEY (tenant)
REFERENCES public."ntf_Tenant" (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT "ntf_Notification_user_fkey" FOREIGN KEY ("user")
REFERENCES public."ntf_User" (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
);
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.028', '2023-12-05 12:00:00.000000+02', now(), 'Add table ntf_Notification.');
END$$;