53 lines
1.7 KiB
SQL
53 lines
1.7 KiB
SQL
DO $$DECLARE
|
|
this_version CONSTANT varchar := '00.01.014';
|
|
BEGIN
|
|
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
|
IF FOUND THEN RETURN; END IF;
|
|
|
|
ALTER TABLE public."Description" DROP CONSTRAINT "Description_profile_fkey";
|
|
|
|
ALTER TABLE public."Description" DROP COLUMN uri;
|
|
|
|
ALTER TABLE public."Description" DROP COLUMN profile;
|
|
|
|
ALTER TABLE public."Description" DROP COLUMN reference;
|
|
|
|
ALTER TABLE public."Description" DROP COLUMN dmp_section_index;
|
|
|
|
ALTER TABLE public."Description" ADD COLUMN description_template uuid NOT NULL;
|
|
|
|
|
|
ALTER TABLE public."Description"
|
|
ALTER COLUMN dmp SET NOT NULL;
|
|
|
|
ALTER TABLE public."Description"
|
|
ADD COLUMN created_by uuid NOT NULL;
|
|
|
|
ALTER TABLE public."Description"
|
|
ADD COLUMN dmp_description_template uuid NOT NULL;
|
|
|
|
ALTER TABLE public."Description"
|
|
ADD FOREIGN KEY (created_by)
|
|
REFERENCES public."UserInfo" (id) MATCH SIMPLE
|
|
ON UPDATE NO ACTION
|
|
ON DELETE NO ACTION
|
|
NOT VALID;
|
|
|
|
ALTER TABLE public."Description"
|
|
ADD FOREIGN KEY (dmp_description_template)
|
|
REFERENCES public."DmpDescriptionTemplate" (id) MATCH SIMPLE
|
|
ON UPDATE NO ACTION
|
|
ON DELETE NO ACTION
|
|
NOT VALID;
|
|
|
|
ALTER TABLE public."Description"
|
|
ADD FOREIGN KEY (description_template)
|
|
REFERENCES public."DescriptionTemplate" (id) MATCH SIMPLE
|
|
ON UPDATE NO ACTION
|
|
ON DELETE NO ACTION
|
|
NOT VALID;
|
|
|
|
|
|
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.014', '2023-11-20 12:00:00.000000+02', now(), 'Sync table Description.');
|
|
|
|
END$$; |