diff --git a/dmp-db-scema/updates/00.01.028_addNotification.sql b/dmp-db-scema/updates/00.01.028_add_ntf_Notification.sql similarity index 52% rename from dmp-db-scema/updates/00.01.028_addNotification.sql rename to dmp-db-scema/updates/00.01.028_add_ntf_Notification.sql index 613fdf6f4..3dfee0c1d 100644 --- a/dmp-db-scema/updates/00.01.028_addNotification.sql +++ b/dmp-db-scema/updates/00.01.028_add_ntf_Notification.sql @@ -4,39 +4,37 @@ BEGIN PERFORM * FROM "DBVersion" WHERE version = this_version; IF FOUND THEN RETURN; END IF; - CREATE TABLE public."Notification" + CREATE TABLE public."ntf_Notification" ( id uuid NOT NULL, "user" uuid, tenant uuid, type uuid, - contact_type_hint character varying(200), - contact_hint character varying(200), + 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, - is_active character varying(100) NOT NULL, - data text, - notify_state character varying(200), - notified_with character varying(200), + data text COLLATE pg_catalog."default", retry_count integer, - tracking_data text, - provenance_ref character varying(200), + 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, - CONSTRAINT "Notification_pkey" PRIMARY KEY (id), - CONSTRAINT "Notification_tenant_fkey" FOREIGN KEY (tenant) + 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."Tenant" (id) MATCH SIMPLE ON UPDATE NO ACTION - ON DELETE NO ACTION - NOT VALID, - CONSTRAINT "Notification_user_fkey" FOREIGN KEY ("user") + ON DELETE NO ACTION, + CONSTRAINT "ntf_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.'); + INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.028', '2023-12-05 12:00:00.000000+02', now(), 'Add table ntf_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 index 13e275c5a..7a227c7c6 100644 --- a/dmp-db-scema/updates/00.01.029_addQueueOutbox.sql +++ b/dmp-db-scema/updates/00.01.029_addQueueOutbox.sql @@ -7,23 +7,23 @@ BEGIN CREATE TABLE public."QueueOutbox" ( id uuid NOT NULL, - exchange character varying(200) NOT NULL, - route character varying(200) 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) 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, + message text COLLATE pg_catalog."default" NOT NULL, + is_active smallint 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.'); diff --git a/dmp-db-scema/updates/00.01.030_addQueueInbox.sql b/dmp-db-scema/updates/00.01.030_addQueueInbox.sql index 09520ba20..13bdb9a53 100644 --- a/dmp-db-scema/updates/00.01.030_addQueueInbox.sql +++ b/dmp-db-scema/updates/00.01.030_addQueueInbox.sql @@ -7,20 +7,20 @@ BEGIN 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, + 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) 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, + tenant uuid, + is_active smallint NOT NULL, CONSTRAINT "QueryInbox_pkey" PRIMARY KEY (id), - CONSTRAINT "QueryInbox_tennant_fkey" FOREIGN KEY (tennant) + CONSTRAINT "QueryInbox_tenant_fkey" FOREIGN KEY (tenant) REFERENCES public."Tenant" (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION diff --git a/dmp-db-scema/updates/00.01.031_addNTFQueueInbox.sql b/dmp-db-scema/updates/00.01.031_add_ntf_QueueInbox.sql similarity index 75% rename from dmp-db-scema/updates/00.01.031_addNTFQueueInbox.sql rename to dmp-db-scema/updates/00.01.031_add_ntf_QueueInbox.sql index 226193914..7524b4833 100644 --- a/dmp-db-scema/updates/00.01.031_addNTFQueueInbox.sql +++ b/dmp-db-scema/updates/00.01.031_add_ntf_QueueInbox.sql @@ -4,7 +4,7 @@ BEGIN PERFORM * FROM "DBVersion" WHERE version = this_version; IF FOUND THEN RETURN; END IF; - CREATE TABLE public."NTFQueueInbox" + CREATE TABLE public."ntf_QueueInbox" ( id uuid NOT NULL, queue character varying(50) COLLATE pg_catalog."default" NOT NULL, @@ -14,18 +14,19 @@ BEGIN 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) + tenant uuid, + is_active smallint NOT NULL, + CONSTRAINT "ntf_QueryInbox_pkey" PRIMARY KEY (id), + CONSTRAINT "ntf_QueryInbox_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.031', '2023-12-05 12:00:00.000000+02', now(), 'Add table NTFQueueInbox.'); + INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.031', '2023-12-05 12:00:00.000000+02', now(), 'Add table ntf_QueueInbox.'); 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_add_ntf_QueueOutbox.sql similarity index 72% rename from dmp-db-scema/updates/00.01.032_addNTFQueueOutbox.sql rename to dmp-db-scema/updates/00.01.032_add_ntf_QueueOutbox.sql index 5f1ecb47e..49f032713 100644 --- a/dmp-db-scema/updates/00.01.032_addNTFQueueOutbox.sql +++ b/dmp-db-scema/updates/00.01.032_add_ntf_QueueOutbox.sql @@ -4,7 +4,7 @@ BEGIN PERFORM * FROM "DBVersion" WHERE version = this_version; IF FOUND THEN RETURN; END IF; - CREATE TABLE public."NTFQueueOutbox" + CREATE TABLE public."ntf_QueueOutbox" ( id uuid NOT NULL, exchange character varying(200) COLLATE pg_catalog."default" NOT NULL, @@ -15,16 +15,17 @@ BEGIN 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) + message text COLLATE pg_catalog."default" NOT NULL, + is_active smallint NOT NULL, + CONSTRAINT "ntf_QueueOutbox_pkey" PRIMARY KEY (id), + CONSTRAINT "ntf_QueueOutbox_tenant_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.'); + INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.032', '2023-12-05 12:00:00.000000+02', now(), 'Add table ntf_QueueOutbox.'); END$$; \ No newline at end of file diff --git a/dmp-db-scema/updates/00.01.033_addNTFInAppNotification.sql b/dmp-db-scema/updates/00.01.033_add_ntf_InAppNotification.sql similarity index 56% rename from dmp-db-scema/updates/00.01.033_addNTFInAppNotification.sql rename to dmp-db-scema/updates/00.01.033_add_ntf_InAppNotification.sql index 970c55628..686aa5195 100644 --- a/dmp-db-scema/updates/00.01.033_addNTFInAppNotification.sql +++ b/dmp-db-scema/updates/00.01.033_add_ntf_InAppNotification.sql @@ -4,34 +4,32 @@ BEGIN PERFORM * FROM "DBVersion" WHERE version = this_version; IF FOUND THEN RETURN; END IF; - CREATE TABLE public."NTFInAppNotification" + CREATE TABLE public."ntf_InAppNotification" ( id uuid NOT NULL, "user" uuid NOT NULL, - is_active timestamp without time zone NOT NULL, type uuid NOT NULL, read_time timestamp without time zone, tracking_state smallint NOT NULL, priority smallint NOT NULL, - subject character varying, - body character varying, - extra_data character varying, + subject character varying COLLATE pg_catalog."default", + body character varying COLLATE pg_catalog."default", + extra_data character varying COLLATE pg_catalog."default", created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, tenant uuid, - CONSTRAINT "NTFInAppNotification_pkey" PRIMARY KEY (id), - CONSTRAINT "NTFInAppNotification_tenant_fkey" FOREIGN KEY (tenant) + is_active smallint NOT NULL, + CONSTRAINT "ntf_InAppNotification_pkey" PRIMARY KEY (id), + CONSTRAINT "ntf_InAppNotification_tenant_fkey" FOREIGN KEY (tenant) REFERENCES public."Tenant" (id) MATCH SIMPLE ON UPDATE NO ACTION - ON DELETE NO ACTION - NOT VALID, - CONSTRAINT "NTFInAppNotification_user_fkey" FOREIGN KEY ("user") + ON DELETE NO ACTION, + CONSTRAINT "ntf_InAppNotification_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.033', '2023-12-05 12:00:00.000000+02', now(), 'Add table NTFInAppNotification.'); + INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.033', '2023-12-05 12:00:00.000000+02', now(), 'Add table ntf_InAppNotification.'); END$$; \ No newline at end of file diff --git a/dmp-db-scema/updates/00.01.034_addNTFUserNotificationPreference.sql b/dmp-db-scema/updates/00.01.034_add_ntf_UserNotificationPreference.sql similarity index 57% rename from dmp-db-scema/updates/00.01.034_addNTFUserNotificationPreference.sql rename to dmp-db-scema/updates/00.01.034_add_ntf_UserNotificationPreference.sql index 8c53d7f4d..1458b0109 100644 --- a/dmp-db-scema/updates/00.01.034_addNTFUserNotificationPreference.sql +++ b/dmp-db-scema/updates/00.01.034_add_ntf_UserNotificationPreference.sql @@ -4,7 +4,7 @@ BEGIN PERFORM * FROM "DBVersion" WHERE version = this_version; IF FOUND THEN RETURN; END IF; - CREATE TABLE public."NTFUserNotificationPreference" + CREATE TABLE public."ntf_UserNotificationPreference" ( "user" uuid NOT NULL, type uuid NOT NULL, @@ -12,19 +12,17 @@ BEGIN ordinal numeric NOT NULL, created_at timestamp without time zone NOT NULL, tenant uuid, - CONSTRAINT "NTFUserNotificationPreference_pkey" PRIMARY KEY ("user", type, channel), - CONSTRAINT "NTFUserNotificationPreference_tennant_fkey" FOREIGN KEY (tenant) + CONSTRAINT "ntf_UserNotificationPreference_pkey" PRIMARY KEY ("user", type, channel), + CONSTRAINT "ntf_UserNotificationPreference_tennant_fkey" FOREIGN KEY (tenant) REFERENCES public."Tenant" (id) MATCH SIMPLE ON UPDATE NO ACTION - ON DELETE NO ACTION - NOT VALID, - CONSTRAINT "NTFUserNotificationPreference_user_fkey" FOREIGN KEY ("user") + ON DELETE NO ACTION, + CONSTRAINT "ntf_UserNotificationPreference_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.034', '2023-12-05 12:00:00.000000+02', now(), 'Add table NTFUserNotificationPreference.'); + INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.034', '2023-12-05 12:00:00.000000+02', now(), 'Add table ntf_UserNotificationPreference.'); END$$; \ No newline at end of file diff --git a/dmp-db-scema/updates/00.01.035_addNTFTenantConfiguration.sql b/dmp-db-scema/updates/00.01.035_add_ntf_TenantConfiguration.sql similarity index 63% rename from dmp-db-scema/updates/00.01.035_addNTFTenantConfiguration.sql rename to dmp-db-scema/updates/00.01.035_add_ntf_TenantConfiguration.sql index 4c4211735..16304c8ba 100644 --- a/dmp-db-scema/updates/00.01.035_addNTFTenantConfiguration.sql +++ b/dmp-db-scema/updates/00.01.035_add_ntf_TenantConfiguration.sql @@ -4,23 +4,22 @@ BEGIN PERFORM * FROM "DBVersion" WHERE version = this_version; IF FOUND THEN RETURN; END IF; - CREATE TABLE public."NTFTenantConfiguration" + CREATE TABLE public."ntf_TenantConfiguration" ( id uuid NOT NULL, tenant uuid NOT NULL, type smallint NOT NULL, - value character varying NOT NULL, + value character varying COLLATE pg_catalog."default" NOT NULL, is_active smallint NOT NULL, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, - CONSTRAINT "NTFTenantConfguration_pkey" PRIMARY KEY (id), - CONSTRAINT "NTFTenantConfiguration_tenant_fkey" FOREIGN KEY (tenant) + CONSTRAINT "ntf_TenantConfguration_pkey" PRIMARY KEY (id), + CONSTRAINT "ntf_TenantConfiguration_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.035', '2023-12-05 12:00:00.000000+02', now(), 'Add table NTFTenantConfiguration.'); + INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.035', '2023-12-05 12:00:00.000000+02', now(), 'Add table ntf_TenantConfiguration.'); END$$; \ No newline at end of file diff --git a/dmp-db-scema/updates/00.01.036_updateQueueOutbox_QueueInbox_NFTQueueOutbox_NFTQueueInbox.sql b/dmp-db-scema/updates/00.01.036_updateQueueOutbox_QueueInbox_NFTQueueOutbox_NFTQueueInbox.sql deleted file mode 100644 index c29190b29..000000000 --- a/dmp-db-scema/updates/00.01.036_updateQueueOutbox_QueueInbox_NFTQueueOutbox_NFTQueueInbox.sql +++ /dev/null @@ -1,48 +0,0 @@ -DO $$DECLARE - this_version CONSTANT varchar := '00.01.036'; -BEGIN - PERFORM * FROM "DBVersion" WHERE version = this_version; - IF FOUND THEN RETURN; END IF; - - ALTER TABLE public."QueueOutbox" - ADD COLUMN message text NOT NULL; - - ALTER TABLE public."QueueOutbox" DROP COLUMN is_active; - - ALTER TABLE public."QueueOutbox" - ADD COLUMN is_active smallint NOT NULL; - - - ALTER TABLE public."QueueInbox" DROP COLUMN is_active; - - ALTER TABLE public."QueueInbox" DROP COLUMN tennant; - - ALTER TABLE public."QueueInbox" - ADD COLUMN tenant uuid; - - ALTER TABLE public."QueueInbox" - ADD COLUMN is_active smallint NOT NULL; - - - ALTER TABLE public."NTFQueueOutbox" - ADD COLUMN message text NOT NULL; - - ALTER TABLE public."NTFQueueOutbox" DROP COLUMN is_active; - - ALTER TABLE public."NTFQueueOutbox" - ADD COLUMN is_active smallint NOT NULL; - - - ALTER TABLE public."NTFQueueInbox" DROP COLUMN is_active; - - ALTER TABLE public."NTFQueueInbox" DROP COLUMN tennant; - - ALTER TABLE public."NTFQueueInbox" - ADD COLUMN tenant uuid; - - ALTER TABLE public."NTFQueueInbox" - ADD COLUMN is_active smallint NOT NULL; - - INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.036', '2023-12-05 12:00:00.000000+02', now(), 'Alter table QueueOutbox, QueueInbox, NFTQueueOutbox, NFTQueueInbox.'); - -END$$; \ No newline at end of file diff --git a/dmp-db-scema/updates/00.01.037_updateNotification_NTFInAppNotification.sql b/dmp-db-scema/updates/00.01.037_updateNotification_NTFInAppNotification.sql deleted file mode 100644 index cc38b1cc6..000000000 --- a/dmp-db-scema/updates/00.01.037_updateNotification_NTFInAppNotification.sql +++ /dev/null @@ -1,36 +0,0 @@ -DO $$DECLARE - this_version CONSTANT varchar := '00.01.037'; -BEGIN - PERFORM * FROM "DBVersion" WHERE version = this_version; - IF FOUND THEN RETURN; END IF; - - ALTER TABLE public."Notification" DROP COLUMN is_active; - - ALTER TABLE public."Notification" - ADD COLUMN is_active smallint NOT NULL; - - ALTER TABLE public."Notification" DROP COLUMN contact_type_hint; - - ALTER TABLE public."Notification" DROP COLUMN notify_state; - - ALTER TABLE public."Notification" DROP COLUMN notified_with; - - ALTER TABLE public."Notification" - ADD COLUMN contact_type_hint smallint; - - ALTER TABLE public."Notification" - ADD COLUMN notify_state smallint; - - ALTER TABLE public."Notification" - ADD COLUMN notified_with smallint; - - - ALTER TABLE public."NTFInAppNotification" DROP COLUMN is_active; - - ALTER TABLE public."NTFInAppNotification" - ADD COLUMN is_active smallint NOT NULL; - - - INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.037', '2023-12-05 12:00:00.000000+02', now(), 'Alter table Notification, NTFInAppNotification.'); - -END$$; \ No newline at end of file