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

40 lines
1.5 KiB
MySQL
Raw Permalink Normal View History

2023-12-05 10:56:25 +01:00
DO $$DECLARE
2024-04-04 17:27:18 +02:00
this_version CONSTANT varchar := '00.01.032';
2023-12-05 10:56:25 +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_Notification"
2023-12-05 10:56:25 +01:00
(
id uuid NOT NULL,
"user" uuid,
tenant uuid,
type uuid,
2023-12-06 10:34:24 +01:00
contact_hint character varying(200) COLLATE pg_catalog."default",
2023-12-05 10:56:25 +01:00
notified_at timestamp without time zone,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
2023-12-06 10:34:24 +01:00
data text COLLATE pg_catalog."default",
2023-12-05 10:56:25 +01:00
retry_count integer,
2023-12-06 10:34:24 +01:00
tracking_data text COLLATE pg_catalog."default",
provenance_ref character varying(200) COLLATE pg_catalog."default",
2023-12-05 10:56:25 +01:00
tracking_state smallint NOT NULL,
tracking_process smallint NOT NULL,
2023-12-06 10:34:24 +01:00
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)
2024-04-04 15:39:40 +02:00
REFERENCES public."ntf_Tenant" (id) MATCH SIMPLE
2023-12-05 10:56:25 +01:00
ON UPDATE NO ACTION
2023-12-06 10:34:24 +01:00
ON DELETE NO ACTION,
CONSTRAINT "ntf_Notification_user_fkey" FOREIGN KEY ("user")
2024-04-04 15:39:40 +02:00
REFERENCES public."ntf_User" (id) MATCH SIMPLE
2023-12-05 10:56:25 +01:00
ON UPDATE NO ACTION
ON DELETE NO ACTION
);
2024-04-04 17:27:18 +02:00
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.032', '2023-12-05 12:00:00.000000+02', now(), 'Add table ntf_Notification.');
2023-12-05 10:56:25 +01:00
END$$;