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

View File

@ -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.');

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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