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

40 lines
1.5 KiB
MySQL
Raw Normal View History

2023-12-05 10:56:25 +01:00
DO $$DECLARE
this_version CONSTANT varchar := '00.01.028';
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)
2023-12-05 10:56:25 +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_Notification_user_fkey" FOREIGN KEY ("user")
2023-12-05 10:56:25 +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.028', '2023-12-05 12:00:00.000000+02', now(), 'Add table ntf_Notification.');
2023-12-05 10:56:25 +01:00
END$$;