diff --git a/dmp-db-scema/updates/00.01.027_renameOldNotification.sql b/dmp-db-scema/updates/00.01.027_renameOldNotification.sql new file mode 100644 index 000000000..72d861f22 --- /dev/null +++ b/dmp-db-scema/updates/00.01.027_renameOldNotification.sql @@ -0,0 +1,18 @@ +DO $$DECLARE + this_version CONSTANT varchar := '00.01.027'; +BEGIN + PERFORM * FROM "DBVersion" WHERE version = this_version; + IF FOUND THEN RETURN; END IF; + + ALTER TABLE public."Notification" + RENAME TO "NotificationLegacy"; + + ALTER TABLE public."NotificationLegacy" + RENAME CONSTRAINT "Notification_pkey" TO "NotificationLegacy_pkey"; + + ALTER TABLE public."NotificationLegacy" + RENAME CONSTRAINT "Notification_UserId_fkey" TO "NotificationLegacy_UserId_fkey"; + + INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.027', '2023-12-05 12:00:00.000000+02', now(), 'Rename table Notification to NotificationLegacy.'); + +END$$; \ No newline at end of file diff --git a/dmp-db-scema/updates/00.01.028_addNotification.sql b/dmp-db-scema/updates/00.01.028_addNotification.sql new file mode 100644 index 000000000..613fdf6f4 --- /dev/null +++ b/dmp-db-scema/updates/00.01.028_addNotification.sql @@ -0,0 +1,42 @@ +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."Notification" + ( + id uuid NOT NULL, + "user" uuid, + tenant uuid, + type uuid, + contact_type_hint character varying(200), + contact_hint character varying(200), + notified_at timestamp without time zone, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + is_active character varying(100) NOT NULL, + data text, + notify_state character varying(200), + notified_with character varying(200), + retry_count integer, + tracking_data text, + provenance_ref character varying(200), + tracking_state smallint NOT NULL, + tracking_process smallint NOT NULL, + CONSTRAINT "Notification_pkey" PRIMARY KEY (id), + CONSTRAINT "Notification_tenant_fkey" FOREIGN KEY (tenant) + REFERENCES public."Tenant" (id) MATCH SIMPLE + ON UPDATE NO ACTION + ON DELETE NO ACTION + NOT VALID, + CONSTRAINT "Notification_user_fkey" FOREIGN KEY ("user") + REFERENCES public."User" (id) MATCH SIMPLE + ON UPDATE NO ACTION + ON DELETE NO ACTION + NOT VALID + ); + + INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.028', '2023-12-05 12:00:00.000000+02', now(), 'Add table Notification.'); + +END$$; \ No newline at end of file diff --git a/dmp-db-scema/updates/00.01.029_addQueueOutbox.sql b/dmp-db-scema/updates/00.01.029_addQueueOutbox.sql new file mode 100644 index 000000000..13e275c5a --- /dev/null +++ b/dmp-db-scema/updates/00.01.029_addQueueOutbox.sql @@ -0,0 +1,31 @@ +DO $$DECLARE + this_version CONSTANT varchar := '00.01.029'; +BEGIN + PERFORM * FROM "DBVersion" WHERE version = this_version; + IF FOUND THEN RETURN; END IF; + + CREATE TABLE public."QueueOutbox" + ( + id uuid NOT NULL, + exchange character varying(200) NOT NULL, + route character varying(200) NOT NULL, + message_id uuid NOT NULL, + notify_status character varying(100) NOT NULL, + retry_count integer NOT NULL, + published_at timestamp without time zone, + confirmed_at timestamp without time zone, + tenant uuid, + is_active timestamp without time zone NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + CONSTRAINT "QueueOutbox_pkey" PRIMARY KEY (id), + CONSTRAINT "QueueOutbox_tennat_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.029', '2023-12-05 12:00:00.000000+02', now(), 'Add table QueueOutbox.'); + +END$$; \ No newline at end of file diff --git a/dmp-db-scema/updates/00.01.030_addQueueInbox.sql b/dmp-db-scema/updates/00.01.030_addQueueInbox.sql new file mode 100644 index 000000000..09520ba20 --- /dev/null +++ b/dmp-db-scema/updates/00.01.030_addQueueInbox.sql @@ -0,0 +1,32 @@ +DO $$DECLARE + this_version CONSTANT varchar := '00.01.030'; +BEGIN + PERFORM * FROM "DBVersion" WHERE version = this_version; + IF FOUND THEN RETURN; END IF; + + CREATE TABLE public."QueueInbox" + ( + id uuid NOT NULL, + queue character varying(50) NOT NULL, + exchange character varying(50) NOT NULL, + route character varying(50) NOT NULL, + application_id character varying(100) NOT NULL, + message_id uuid NOT NULL, + message json NOT NULL, + retry_count integer, + tennant uuid, + is_active timestamp without time zone NOT NULL, + status character varying(50) NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + CONSTRAINT "QueryInbox_pkey" PRIMARY KEY (id), + CONSTRAINT "QueryInbox_tennant_fkey" FOREIGN KEY (tennant) + REFERENCES public."Tenant" (id) MATCH SIMPLE + ON UPDATE NO ACTION + ON DELETE NO ACTION + NOT VALID + ); + + INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.030', '2023-12-05 12:00:00.000000+02', now(), 'Add table QueueInbox.'); + +END$$; \ No newline at end of file diff --git a/dmp-db-scema/updates/00.01.031_addNTFQueueInbox.sql b/dmp-db-scema/updates/00.01.031_addNTFQueueInbox.sql new file mode 100644 index 000000000..226193914 --- /dev/null +++ b/dmp-db-scema/updates/00.01.031_addNTFQueueInbox.sql @@ -0,0 +1,31 @@ +DO $$DECLARE + this_version CONSTANT varchar := '00.01.031'; +BEGIN + PERFORM * FROM "DBVersion" WHERE version = this_version; + IF FOUND THEN RETURN; END IF; + + CREATE TABLE public."NTFQueueInbox" + ( + id uuid NOT NULL, + queue character varying(50) COLLATE pg_catalog."default" NOT NULL, + exchange character varying(50) COLLATE pg_catalog."default" NOT NULL, + route character varying(50) COLLATE pg_catalog."default" NOT NULL, + application_id character varying(100) COLLATE pg_catalog."default" NOT NULL, + message_id uuid NOT NULL, + message json NOT NULL, + retry_count integer, + tennant uuid, + is_active timestamp without time zone NOT NULL, + status character varying(50) COLLATE pg_catalog."default" NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + CONSTRAINT "NTFQueryInbox_pkey" PRIMARY KEY (id), + CONSTRAINT "NTFQueryInbox_tennant_fkey" FOREIGN KEY (tennant) + REFERENCES public."Tenant" (id) MATCH SIMPLE + ON UPDATE NO ACTION + ON DELETE NO ACTION + ); + + INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.031', '2023-12-05 12:00:00.000000+02', now(), 'Add table NTFQueueInbox.'); + +END$$; \ No newline at end of file diff --git a/dmp-db-scema/updates/00.01.032_addNTFQueueOutbox.sql b/dmp-db-scema/updates/00.01.032_addNTFQueueOutbox.sql new file mode 100644 index 000000000..5f1ecb47e --- /dev/null +++ b/dmp-db-scema/updates/00.01.032_addNTFQueueOutbox.sql @@ -0,0 +1,30 @@ +DO $$DECLARE + this_version CONSTANT varchar := '00.01.032'; +BEGIN + PERFORM * FROM "DBVersion" WHERE version = this_version; + IF FOUND THEN RETURN; END IF; + + CREATE TABLE public."NTFQueueOutbox" + ( + id uuid NOT NULL, + exchange character varying(200) COLLATE pg_catalog."default" NOT NULL, + route character varying(200) COLLATE pg_catalog."default" NOT NULL, + message_id uuid NOT NULL, + notify_status character varying(100) COLLATE pg_catalog."default" NOT NULL, + retry_count integer NOT NULL, + published_at timestamp without time zone, + confirmed_at timestamp without time zone, + tenant uuid, + is_active timestamp without time zone NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + CONSTRAINT "NTFQueueOutbox_pkey" PRIMARY KEY (id), + CONSTRAINT "NTFQueueOutbox_tennat_fkey" FOREIGN KEY (tenant) + REFERENCES public."Tenant" (id) MATCH SIMPLE + ON UPDATE NO ACTION + ON DELETE NO ACTION + ); + + INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.032', '2023-12-05 12:00:00.000000+02', now(), 'Add table NTFQueueOutboox.'); + +END$$; \ No newline at end of file