rename NTF to ntf scripts

This commit is contained in:
amentis 2023-12-06 11:34:24 +02:00
parent ce0075f30a
commit 2dac2326ee
10 changed files with 61 additions and 150 deletions

View File

@ -4,39 +4,37 @@ BEGIN
PERFORM * FROM "DBVersion" WHERE version = this_version; PERFORM * FROM "DBVersion" WHERE version = this_version;
IF FOUND THEN RETURN; END IF; IF FOUND THEN RETURN; END IF;
CREATE TABLE public."Notification" CREATE TABLE public."ntf_Notification"
( (
id uuid NOT NULL, id uuid NOT NULL,
"user" uuid, "user" uuid,
tenant uuid, tenant uuid,
type uuid, type uuid,
contact_type_hint character varying(200), contact_hint character varying(200) COLLATE pg_catalog."default",
contact_hint character varying(200),
notified_at timestamp without time zone, notified_at timestamp without time zone,
created_at timestamp without time zone NOT NULL, created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL,
is_active character varying(100) NOT NULL, data text COLLATE pg_catalog."default",
data text,
notify_state character varying(200),
notified_with character varying(200),
retry_count integer, retry_count integer,
tracking_data text, tracking_data text COLLATE pg_catalog."default",
provenance_ref character varying(200), provenance_ref character varying(200) COLLATE pg_catalog."default",
tracking_state smallint NOT NULL, tracking_state smallint NOT NULL,
tracking_process smallint NOT NULL, tracking_process smallint NOT NULL,
CONSTRAINT "Notification_pkey" PRIMARY KEY (id), is_active smallint NOT NULL,
CONSTRAINT "Notification_tenant_fkey" FOREIGN KEY (tenant) 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 REFERENCES public."Tenant" (id) MATCH SIMPLE
ON UPDATE NO ACTION ON UPDATE NO ACTION
ON DELETE NO ACTION ON DELETE NO ACTION,
NOT VALID, CONSTRAINT "ntf_Notification_user_fkey" FOREIGN KEY ("user")
CONSTRAINT "Notification_user_fkey" FOREIGN KEY ("user")
REFERENCES public."User" (id) MATCH SIMPLE REFERENCES public."User" (id) MATCH SIMPLE
ON UPDATE NO ACTION ON UPDATE NO ACTION
ON DELETE 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$$; END$$;

View File

@ -7,23 +7,23 @@ BEGIN
CREATE TABLE public."QueueOutbox" CREATE TABLE public."QueueOutbox"
( (
id uuid NOT NULL, id uuid NOT NULL,
exchange character varying(200) NOT NULL, exchange character varying(200) COLLATE pg_catalog."default" NOT NULL,
route character varying(200) NOT NULL, route character varying(200) COLLATE pg_catalog."default" NOT NULL,
message_id uuid 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, retry_count integer NOT NULL,
published_at timestamp without time zone, published_at timestamp without time zone,
confirmed_at timestamp without time zone, confirmed_at timestamp without time zone,
tenant uuid, tenant uuid,
is_active timestamp without time zone NOT NULL,
created_at timestamp without time zone NOT NULL, created_at timestamp without time zone NOT NULL,
updated_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_pkey" PRIMARY KEY (id),
CONSTRAINT "QueueOutbox_tennat_fkey" FOREIGN KEY (tenant) CONSTRAINT "QueueOutbox_tennat_fkey" FOREIGN KEY (tenant)
REFERENCES public."Tenant" (id) MATCH SIMPLE REFERENCES public."Tenant" (id) MATCH SIMPLE
ON UPDATE NO ACTION ON UPDATE NO ACTION
ON DELETE 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.'); INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.029', '2023-12-05 12:00:00.000000+02', now(), 'Add table QueueOutbox.');

View File

@ -7,20 +7,20 @@ BEGIN
CREATE TABLE public."QueueInbox" CREATE TABLE public."QueueInbox"
( (
id uuid NOT NULL, id uuid NOT NULL,
queue character varying(50) NOT NULL, queue character varying(50) COLLATE pg_catalog."default" NOT NULL,
exchange character varying(50) NOT NULL, exchange character varying(50) COLLATE pg_catalog."default" NOT NULL,
route character varying(50) NOT NULL, route character varying(50) COLLATE pg_catalog."default" NOT NULL,
application_id character varying(100) NOT NULL, application_id character varying(100) COLLATE pg_catalog."default" NOT NULL,
message_id uuid NOT NULL, message_id uuid NOT NULL,
message json NOT NULL, message json NOT NULL,
retry_count integer, retry_count integer,
tennant uuid, status character varying(50) COLLATE pg_catalog."default" NOT NULL,
is_active timestamp without time zone NOT NULL,
status character varying(50) NOT NULL,
created_at timestamp without time zone NOT NULL, created_at timestamp without time zone NOT NULL,
updated_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_pkey" PRIMARY KEY (id),
CONSTRAINT "QueryInbox_tennant_fkey" FOREIGN KEY (tennant) CONSTRAINT "QueryInbox_tenant_fkey" FOREIGN KEY (tenant)
REFERENCES public."Tenant" (id) MATCH SIMPLE REFERENCES public."Tenant" (id) MATCH SIMPLE
ON UPDATE NO ACTION ON UPDATE NO ACTION
ON DELETE NO ACTION ON DELETE NO ACTION

View File

@ -4,7 +4,7 @@ BEGIN
PERFORM * FROM "DBVersion" WHERE version = this_version; PERFORM * FROM "DBVersion" WHERE version = this_version;
IF FOUND THEN RETURN; END IF; IF FOUND THEN RETURN; END IF;
CREATE TABLE public."NTFQueueInbox" CREATE TABLE public."ntf_QueueInbox"
( (
id uuid NOT NULL, id uuid NOT NULL,
queue character varying(50) COLLATE pg_catalog."default" NOT NULL, queue character varying(50) COLLATE pg_catalog."default" NOT NULL,
@ -14,18 +14,19 @@ BEGIN
message_id uuid NOT NULL, message_id uuid NOT NULL,
message json NOT NULL, message json NOT NULL,
retry_count integer, retry_count integer,
tennant uuid,
is_active timestamp without time zone NOT NULL,
status character varying(50) COLLATE pg_catalog."default" NOT NULL, status character varying(50) COLLATE pg_catalog."default" NOT NULL,
created_at timestamp without time zone NOT NULL, created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL,
CONSTRAINT "NTFQueryInbox_pkey" PRIMARY KEY (id), tenant uuid,
CONSTRAINT "NTFQueryInbox_tennant_fkey" FOREIGN KEY (tennant) 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 REFERENCES public."Tenant" (id) MATCH SIMPLE
ON UPDATE NO ACTION ON UPDATE NO ACTION
ON DELETE 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$$; END$$;

View File

@ -4,7 +4,7 @@ BEGIN
PERFORM * FROM "DBVersion" WHERE version = this_version; PERFORM * FROM "DBVersion" WHERE version = this_version;
IF FOUND THEN RETURN; END IF; IF FOUND THEN RETURN; END IF;
CREATE TABLE public."NTFQueueOutbox" CREATE TABLE public."ntf_QueueOutbox"
( (
id uuid NOT NULL, id uuid NOT NULL,
exchange character varying(200) COLLATE pg_catalog."default" NOT NULL, exchange character varying(200) COLLATE pg_catalog."default" NOT NULL,
@ -15,16 +15,17 @@ BEGIN
published_at timestamp without time zone, published_at timestamp without time zone,
confirmed_at timestamp without time zone, confirmed_at timestamp without time zone,
tenant uuid, tenant uuid,
is_active timestamp without time zone NOT NULL,
created_at timestamp without time zone NOT NULL, created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL,
CONSTRAINT "NTFQueueOutbox_pkey" PRIMARY KEY (id), message text COLLATE pg_catalog."default" NOT NULL,
CONSTRAINT "NTFQueueOutbox_tennat_fkey" FOREIGN KEY (tenant) 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 REFERENCES public."Tenant" (id) MATCH SIMPLE
ON UPDATE NO ACTION ON UPDATE NO ACTION
ON DELETE 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$$; END$$;

View File

@ -4,34 +4,32 @@ BEGIN
PERFORM * FROM "DBVersion" WHERE version = this_version; PERFORM * FROM "DBVersion" WHERE version = this_version;
IF FOUND THEN RETURN; END IF; IF FOUND THEN RETURN; END IF;
CREATE TABLE public."NTFInAppNotification" CREATE TABLE public."ntf_InAppNotification"
( (
id uuid NOT NULL, id uuid NOT NULL,
"user" uuid NOT NULL, "user" uuid NOT NULL,
is_active timestamp without time zone NOT NULL,
type uuid NOT NULL, type uuid NOT NULL,
read_time timestamp without time zone, read_time timestamp without time zone,
tracking_state smallint NOT NULL, tracking_state smallint NOT NULL,
priority smallint NOT NULL, priority smallint NOT NULL,
subject character varying, subject character varying COLLATE pg_catalog."default",
body character varying, body character varying COLLATE pg_catalog."default",
extra_data character varying, extra_data character varying COLLATE pg_catalog."default",
created_at timestamp without time zone NOT NULL, created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL,
tenant uuid, tenant uuid,
CONSTRAINT "NTFInAppNotification_pkey" PRIMARY KEY (id), is_active smallint NOT NULL,
CONSTRAINT "NTFInAppNotification_tenant_fkey" FOREIGN KEY (tenant) CONSTRAINT "ntf_InAppNotification_pkey" PRIMARY KEY (id),
CONSTRAINT "ntf_InAppNotification_tenant_fkey" FOREIGN KEY (tenant)
REFERENCES public."Tenant" (id) MATCH SIMPLE REFERENCES public."Tenant" (id) MATCH SIMPLE
ON UPDATE NO ACTION ON UPDATE NO ACTION
ON DELETE NO ACTION ON DELETE NO ACTION,
NOT VALID, CONSTRAINT "ntf_InAppNotification_user_fkey" FOREIGN KEY ("user")
CONSTRAINT "NTFInAppNotification_user_fkey" FOREIGN KEY ("user")
REFERENCES public."User" (id) MATCH SIMPLE REFERENCES public."User" (id) MATCH SIMPLE
ON UPDATE NO ACTION ON UPDATE NO ACTION
ON DELETE 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$$; END$$;

View File

@ -4,7 +4,7 @@ BEGIN
PERFORM * FROM "DBVersion" WHERE version = this_version; PERFORM * FROM "DBVersion" WHERE version = this_version;
IF FOUND THEN RETURN; END IF; IF FOUND THEN RETURN; END IF;
CREATE TABLE public."NTFUserNotificationPreference" CREATE TABLE public."ntf_UserNotificationPreference"
( (
"user" uuid NOT NULL, "user" uuid NOT NULL,
type uuid NOT NULL, type uuid NOT NULL,
@ -12,19 +12,17 @@ BEGIN
ordinal numeric NOT NULL, ordinal numeric NOT NULL,
created_at timestamp without time zone NOT NULL, created_at timestamp without time zone NOT NULL,
tenant uuid, tenant uuid,
CONSTRAINT "NTFUserNotificationPreference_pkey" PRIMARY KEY ("user", type, channel), CONSTRAINT "ntf_UserNotificationPreference_pkey" PRIMARY KEY ("user", type, channel),
CONSTRAINT "NTFUserNotificationPreference_tennant_fkey" FOREIGN KEY (tenant) CONSTRAINT "ntf_UserNotificationPreference_tennant_fkey" FOREIGN KEY (tenant)
REFERENCES public."Tenant" (id) MATCH SIMPLE REFERENCES public."Tenant" (id) MATCH SIMPLE
ON UPDATE NO ACTION ON UPDATE NO ACTION
ON DELETE NO ACTION ON DELETE NO ACTION,
NOT VALID, CONSTRAINT "ntf_UserNotificationPreference_user_fkey" FOREIGN KEY ("user")
CONSTRAINT "NTFUserNotificationPreference_user_fkey" FOREIGN KEY ("user")
REFERENCES public."User" (id) MATCH SIMPLE REFERENCES public."User" (id) MATCH SIMPLE
ON UPDATE NO ACTION ON UPDATE NO ACTION
ON DELETE 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$$; END$$;

View File

@ -4,23 +4,22 @@ BEGIN
PERFORM * FROM "DBVersion" WHERE version = this_version; PERFORM * FROM "DBVersion" WHERE version = this_version;
IF FOUND THEN RETURN; END IF; IF FOUND THEN RETURN; END IF;
CREATE TABLE public."NTFTenantConfiguration" CREATE TABLE public."ntf_TenantConfiguration"
( (
id uuid NOT NULL, id uuid NOT NULL,
tenant uuid NOT NULL, tenant uuid NOT NULL,
type smallint 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, is_active smallint NOT NULL,
created_at timestamp without time zone NOT NULL, created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL,
CONSTRAINT "NTFTenantConfguration_pkey" PRIMARY KEY (id), CONSTRAINT "ntf_TenantConfguration_pkey" PRIMARY KEY (id),
CONSTRAINT "NTFTenantConfiguration_tenant_fkey" FOREIGN KEY (tenant) CONSTRAINT "ntf_TenantConfiguration_tenant_fkey" FOREIGN KEY (tenant)
REFERENCES public."Tenant" (id) MATCH SIMPLE REFERENCES public."Tenant" (id) MATCH SIMPLE
ON UPDATE NO ACTION ON UPDATE NO ACTION
ON DELETE 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$$; END$$;

View File

@ -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$$;

View File

@ -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$$;