reorder sql scripts
This commit is contained in:
parent
443ce153ee
commit
1bd8a9f09d
|
@ -3,6 +3,20 @@ DO $$DECLARE
|
|||
BEGIN
|
||||
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
||||
IF FOUND THEN RETURN; END IF;
|
||||
CREATE TABLE public."ReferenceType"
|
||||
(
|
||||
id uuid NOT NULL,
|
||||
name character varying(250) COLLATE pg_catalog."default" NOT NULL,
|
||||
code character varying(100) COLLATE pg_catalog."default" NOT NULL,
|
||||
definition 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 "ReferenceType_pkey" PRIMARY KEY (id)
|
||||
)
|
||||
WITH (
|
||||
OIDS = FALSE
|
||||
);
|
||||
|
||||
CREATE TABLE public."Reference"
|
||||
(
|
||||
|
@ -24,29 +38,12 @@ BEGIN
|
|||
REFERENCES public."UserInfo" (id) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
NOT VALID
|
||||
)
|
||||
WITH (
|
||||
OIDS = FALSE
|
||||
);
|
||||
|
||||
ALTER TABLE public."Reference"
|
||||
ADD CONSTRAINT "Reference_type_fkey" FOREIGN KEY (type)
|
||||
REFERENCES public."ReferenceType" (id)
|
||||
NOT VALID,
|
||||
CONSTRAINT "Reference_type_fkey" FOREIGN KEY (type)
|
||||
REFERENCES public."ReferenceType" (id) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
NOT VALID;
|
||||
|
||||
CREATE TABLE public."ReferenceType"
|
||||
(
|
||||
id uuid NOT NULL,
|
||||
name character varying(250) COLLATE pg_catalog."default" NOT NULL,
|
||||
code character varying(100) COLLATE pg_catalog."default" NOT NULL,
|
||||
definition 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 "ReferenceType_pkey" PRIMARY KEY (id)
|
||||
NOT VALID
|
||||
)
|
||||
WITH (
|
||||
OIDS = FALSE
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
DO $$DECLARE
|
||||
this_version CONSTANT varchar := '00.01.035';
|
||||
this_version CONSTANT varchar := '00.01.031';
|
||||
BEGIN
|
||||
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
||||
IF FOUND THEN RETURN; END IF;
|
||||
|
@ -30,6 +30,6 @@ BEGIN
|
|||
ON DELETE NO ACTION
|
||||
);
|
||||
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.035', '2023-12-05 12:00:00.000000+02', now(), 'Add tables ntf_Tenant and ntf_TenantConfiguration.');
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.031', '2023-12-05 12:00:00.000000+02', now(), 'Add tables ntf_Tenant and ntf_TenantConfiguration.');
|
||||
|
||||
END$$;
|
|
@ -1,5 +1,5 @@
|
|||
DO $$DECLARE
|
||||
this_version CONSTANT varchar := '00.01.043';
|
||||
this_version CONSTANT varchar := '00.01.032';
|
||||
BEGIN
|
||||
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
||||
IF FOUND THEN RETURN; END IF;
|
||||
|
@ -15,6 +15,6 @@ BEGIN
|
|||
CONSTRAINT "Ntf_User_pkey" PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.043', '2024-01-24 12:00:00.000000+02', now(), 'Add table ntf_User.');
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.032', '2024-01-24 12:00:00.000000+02', now(), 'Add table ntf_User.');
|
||||
|
||||
END$$;
|
|
@ -1,5 +1,5 @@
|
|||
DO $$DECLARE
|
||||
this_version CONSTANT varchar := '00.01.044';
|
||||
this_version CONSTANT varchar := '00.01.033';
|
||||
BEGIN
|
||||
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
||||
IF FOUND THEN RETURN; END IF;
|
||||
|
@ -27,6 +27,6 @@ CREATE TABLE IF NOT EXISTS public."ntf_UserContactInfo"
|
|||
ON DELETE NO ACTION
|
||||
);
|
||||
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.044', '2024-01-24 12:00:00.000000+02', now(), 'Add table ntf_UserContactInfo.');
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.033', '2024-01-24 12:00:00.000000+02', now(), 'Add table ntf_UserContactInfo.');
|
||||
|
||||
END$$;
|
|
@ -1,5 +1,5 @@
|
|||
DO $$DECLARE
|
||||
this_version CONSTANT varchar := '00.01.045';
|
||||
this_version CONSTANT varchar := '00.01.034';
|
||||
BEGIN
|
||||
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
||||
IF FOUND THEN RETURN; END IF;
|
||||
|
@ -26,6 +26,6 @@ CREATE TABLE IF NOT EXISTS public."ntf_UserCredential"
|
|||
ON DELETE NO ACTION
|
||||
);
|
||||
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.045', '2024-01-24 12:00:00.000000+02', now(), 'Add table ntf_UserCredential.');
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.034', '2024-01-24 12:00:00.000000+02', now(), 'Add table ntf_UserCredential.');
|
||||
|
||||
END$$;
|
|
@ -1,5 +1,5 @@
|
|||
DO $$DECLARE
|
||||
this_version CONSTANT varchar := '00.01.046';
|
||||
this_version CONSTANT varchar := '00.01.035';
|
||||
BEGIN
|
||||
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
||||
IF FOUND THEN RETURN; END IF;
|
||||
|
@ -23,6 +23,6 @@ CREATE TABLE IF NOT EXISTS public."ntf_TenantUser"
|
|||
ON DELETE NO ACTION
|
||||
);
|
||||
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.046', '2024-01-25 12:00:00.000000+02', now(), 'Add table ntf_TenantUser.');
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.035', '2024-01-25 12:00:00.000000+02', now(), 'Add table ntf_TenantUser.');
|
||||
|
||||
END$$;
|
|
@ -1,5 +1,5 @@
|
|||
DO $$DECLARE
|
||||
this_version CONSTANT varchar := '00.01.041';
|
||||
this_version CONSTANT varchar := '00.01.036';
|
||||
BEGIN
|
||||
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
||||
IF FOUND THEN RETURN; END IF;
|
||||
|
@ -29,6 +29,6 @@ BEGIN
|
|||
NOT VALID
|
||||
);
|
||||
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.041', '2023-12-15 12:00:00.000000+02', now(), 'Add ntf_NotificationTemplate table.');
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.036', '2023-12-15 12:00:00.000000+02', now(), 'Add ntf_NotificationTemplate table.');
|
||||
|
||||
END$$;
|
|
@ -1,5 +1,5 @@
|
|||
DO $$DECLARE
|
||||
this_version CONSTANT varchar := '00.01.031';
|
||||
this_version CONSTANT varchar := '00.01.037';
|
||||
BEGIN
|
||||
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
||||
IF FOUND THEN RETURN; END IF;
|
||||
|
@ -27,6 +27,6 @@ BEGIN
|
|||
NOT VALID
|
||||
);
|
||||
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.031', '2023-12-05 12:00:00.000000+02', now(), 'Add table ntf_QueueInbox.');
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.037', '2023-12-05 12:00:00.000000+02', now(), 'Add table ntf_QueueInbox.');
|
||||
|
||||
END$$;
|
|
@ -1,5 +1,5 @@
|
|||
DO $$DECLARE
|
||||
this_version CONSTANT varchar := '00.01.032';
|
||||
this_version CONSTANT varchar := '00.01.038';
|
||||
BEGIN
|
||||
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
||||
IF FOUND THEN RETURN; END IF;
|
||||
|
@ -26,6 +26,6 @@ BEGIN
|
|||
ON DELETE NO ACTION
|
||||
);
|
||||
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.032', '2023-12-05 12:00:00.000000+02', now(), 'Add table ntf_QueueOutbox.');
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.038', '2023-12-05 12:00:00.000000+02', now(), 'Add table ntf_QueueOutbox.');
|
||||
|
||||
END$$;
|
|
@ -1,5 +1,5 @@
|
|||
DO $$DECLARE
|
||||
this_version CONSTANT varchar := '00.01.033';
|
||||
this_version CONSTANT varchar := '00.01.039';
|
||||
BEGIN
|
||||
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
||||
IF FOUND THEN RETURN; END IF;
|
||||
|
@ -30,6 +30,6 @@ BEGIN
|
|||
ON DELETE NO ACTION
|
||||
);
|
||||
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.033', '2023-12-05 12:00:00.000000+02', now(), 'Add table ntf_InAppNotification.');
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.039', '2023-12-05 12:00:00.000000+02', now(), 'Add table ntf_InAppNotification.');
|
||||
|
||||
END$$;
|
|
@ -1,5 +1,5 @@
|
|||
DO $$DECLARE
|
||||
this_version CONSTANT varchar := '00.01.034';
|
||||
this_version CONSTANT varchar := '00.01.040';
|
||||
BEGIN
|
||||
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
||||
IF FOUND THEN RETURN; END IF;
|
||||
|
@ -25,6 +25,6 @@ BEGIN
|
|||
ON DELETE NO ACTION
|
||||
);
|
||||
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.034', '2023-12-05 12:00:00.000000+02', now(), 'Add table ntf_UserNotificationPreference.');
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.040', '2023-12-05 12:00:00.000000+02', now(), 'Add table ntf_UserNotificationPreference.');
|
||||
|
||||
END$$;
|
|
@ -1,5 +1,5 @@
|
|||
DO $$DECLARE
|
||||
this_version CONSTANT varchar := '00.01.036';
|
||||
this_version CONSTANT varchar := '00.01.041';
|
||||
BEGIN
|
||||
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
||||
IF FOUND THEN RETURN; END IF;
|
||||
|
@ -25,6 +25,6 @@ BEGIN
|
|||
NOT VALID
|
||||
);
|
||||
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.036', '2023-12-06 12:00:00.000000+02', now(), 'Add table TenantUser.');
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.041', '2023-12-06 12:00:00.000000+02', now(), 'Add table TenantUser.');
|
||||
|
||||
END$$;
|
|
@ -1,5 +1,5 @@
|
|||
DO $$DECLARE
|
||||
this_version CONSTANT varchar := '00.01.037';
|
||||
this_version CONSTANT varchar := '00.01.042';
|
||||
BEGIN
|
||||
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
||||
IF FOUND THEN RETURN; END IF;
|
||||
|
@ -7,6 +7,6 @@ BEGIN
|
|||
ALTER TABLE public.usersettings
|
||||
RENAME TO "UserSettings";
|
||||
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.037', '2023-12-06 12:00:00.000000+02', now(), 'Rename usersettings Table to UserSettings.');
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.042', '2023-12-06 12:00:00.000000+02', now(), 'Rename usersettings Table to UserSettings.');
|
||||
|
||||
END$$;
|
|
@ -1,5 +1,5 @@
|
|||
DO $$DECLARE
|
||||
this_version CONSTANT varchar := '00.01.038';
|
||||
this_version CONSTANT varchar := '00.01.043';
|
||||
BEGIN
|
||||
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
||||
IF FOUND THEN RETURN; END IF;
|
||||
|
@ -202,6 +202,6 @@ BEGIN
|
|||
ON DELETE NO ACTION
|
||||
NOT VALID;
|
||||
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.038', '2023-12-06 12:00:00.000000+02', now(), 'Add Tenant Id to tables.');
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.043', '2023-12-06 12:00:00.000000+02', now(), 'Add Tenant Id to tables.');
|
||||
|
||||
END$$;
|
|
@ -1,5 +1,5 @@
|
|||
DO $$DECLARE
|
||||
this_version CONSTANT varchar := '00.01.039';
|
||||
this_version CONSTANT varchar := '00.01.044';
|
||||
BEGIN
|
||||
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
||||
IF FOUND THEN RETURN; END IF;
|
||||
|
@ -28,6 +28,6 @@ BEGIN
|
|||
NOT VALID
|
||||
);
|
||||
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.039', '2023-12-08 12:00:00.000000+02', now(), 'Drop old Lock Table and create New Lock table.');
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.044', '2023-12-08 12:00:00.000000+02', now(), 'Drop old Lock Table and create New Lock table.');
|
||||
|
||||
END$$;
|
|
@ -1,5 +1,5 @@
|
|||
DO $$DECLARE
|
||||
this_version CONSTANT varchar := '00.01.040';
|
||||
this_version CONSTANT varchar := '00.01.045';
|
||||
BEGIN
|
||||
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
||||
IF FOUND THEN RETURN; END IF;
|
||||
|
@ -30,6 +30,6 @@ BEGIN
|
|||
NOT VALID
|
||||
);
|
||||
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.040', '2023-12-13 12:00:00.000000+02', now(), 'Add ActionConfirmation table.');
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.045', '2023-12-13 12:00:00.000000+02', now(), 'Add ActionConfirmation table.');
|
||||
|
||||
END$$;
|
|
@ -1,5 +1,5 @@
|
|||
DO $$DECLARE
|
||||
this_version CONSTANT varchar := '00.01.042';
|
||||
this_version CONSTANT varchar := '00.01.046';
|
||||
BEGIN
|
||||
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
||||
IF FOUND THEN RETURN; END IF;
|
||||
|
@ -12,6 +12,6 @@ ALTER TABLE IF EXISTS public."EntityDoi"
|
|||
ALTER TABLE IF EXISTS public."EntityDoi"
|
||||
ALTER COLUMN entity_type DROP DEFAULT;
|
||||
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.042', '2023-12-27 12:00:00.000000+02', now(), 'Change Entity Type To Enum at Entity DOI table');
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.046', '2023-12-27 12:00:00.000000+02', now(), 'Change Entity Type To Enum at Entity DOI table');
|
||||
|
||||
END$$;
|
Loading…
Reference in New Issue