45 lines
3.1 KiB
MySQL
45 lines
3.1 KiB
MySQL
|
DO $$DECLARE
|
||
|
this_version CONSTANT varchar := '00.01.066';
|
||
|
BEGIN
|
||
|
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
||
|
IF FOUND THEN RETURN; END IF;
|
||
|
|
||
|
ALTER TABLE IF EXISTS public."Description" RENAME dmp TO plan;
|
||
|
ALTER TABLE IF EXISTS public."Description" RENAME dmp_description_template TO plan_description_template;
|
||
|
ALTER TABLE IF EXISTS public."Description" RENAME CONSTRAINT "Description_dmp_description_template_fkey" TO "Description_plan_description_template_fkey";
|
||
|
ALTER TABLE IF EXISTS public."Description" RENAME CONSTRAINT "Description_dmp_fkey" TO "Description_plan_fkey";
|
||
|
|
||
|
ALTER TABLE IF EXISTS public."DmpBlueprint" RENAME TO "PlanBlueprint";
|
||
|
ALTER TABLE public."PlanBlueprint" RENAME CONSTRAINT "DMPPRofile_pkey" TO "PlanBlueprint_pkey";
|
||
|
ALTER TABLE IF EXISTS public."PlanBlueprint" RENAME CONSTRAINT "DmpBlueprint_tenant_fkey" TO "PlanBlueprint_tenant_fkey";
|
||
|
|
||
|
ALTER TABLE IF EXISTS public."DmpDescriptionTemplate" RENAME TO "PlanDescriptionTemplate";
|
||
|
ALTER TABLE IF EXISTS public."PlanDescriptionTemplate" RENAME dmp TO plan;
|
||
|
ALTER TABLE public."PlanDescriptionTemplate" RENAME CONSTRAINT "DmpDescriptionTemplate_pkey" TO "PlanDescriptionTemplate_pkey";
|
||
|
ALTER TABLE IF EXISTS public."PlanDescriptionTemplate" RENAME CONSTRAINT "DmpDescriptionTemplate_dmp_fkey" TO "PlanDescriptionTemplate_plan_fkey";
|
||
|
ALTER TABLE IF EXISTS public."PlanDescriptionTemplate" RENAME CONSTRAINT "DmpDescriptionTemplate_tenant_fkey" TO "PlanDescriptionTemplate_tenant_fkey";
|
||
|
|
||
|
|
||
|
ALTER TABLE IF EXISTS public."Dmp" RENAME TO "Plan";
|
||
|
ALTER TABLE public."Plan" RENAME CONSTRAINT "Dmp_pkey" TO "Plan_pkey";
|
||
|
ALTER TABLE IF EXISTS public."Plan" RENAME CONSTRAINT "Dmp_blueprint_fkey" TO "Plan_blueprint_fkey";
|
||
|
ALTER TABLE IF EXISTS public."Plan" RENAME CONSTRAINT "Dmp_creator_fkey" TO "Plan_creator_fkey";
|
||
|
ALTER TABLE IF EXISTS public."Plan" RENAME CONSTRAINT "Dmp_tenant_fkey" TO "Plan_tenant_fkey";
|
||
|
|
||
|
ALTER TABLE IF EXISTS public."DmpReference" RENAME TO "PlanReference";
|
||
|
ALTER TABLE IF EXISTS public."PlanReference" RENAME dmp_id TO plan_id;
|
||
|
ALTER TABLE public."PlanReference" RENAME CONSTRAINT "DmpReference_pkey" TO "PlanReference_pkey";
|
||
|
ALTER TABLE IF EXISTS public."PlanReference" RENAME CONSTRAINT "DmpReference_dmp_id_fkey" TO "PlanReference_plan_id_fkey";
|
||
|
ALTER TABLE IF EXISTS public."PlanReference" RENAME CONSTRAINT "DmpReference_reference_id_fkey" TO "PlanReference_reference_id_fkey";
|
||
|
ALTER TABLE IF EXISTS public."PlanReference" RENAME CONSTRAINT "DmpReference_tenant_fkey" TO "PlanReference_tenant_fkey";
|
||
|
|
||
|
ALTER TABLE IF EXISTS public."DmpUser" RENAME TO "PlanUser";
|
||
|
ALTER TABLE IF EXISTS public."PlanUser" RENAME dmp TO plan;
|
||
|
ALTER TABLE public."PlanUser" RENAME CONSTRAINT "DmpUser_pkey" TO "PlanUser_pkey";
|
||
|
ALTER TABLE IF EXISTS public."PlanUser" RENAME CONSTRAINT "DmpUser_dmp_fkey" TO "PlanUser_plan_fkey";
|
||
|
ALTER TABLE IF EXISTS public."PlanUser" RENAME CONSTRAINT "DmpUser_tenant_fkey" TO "PlanUser_tenant_fkey";
|
||
|
ALTER TABLE IF EXISTS public."PlanUser" RENAME CONSTRAINT "DmpUser_user_fkey" TO "PlanUser_user_fkey";
|
||
|
|
||
|
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.066', '2024-07-05 12:00:00.000000+02', now(), 'Rename dmp to plan.');
|
||
|
|
||
|
END$$;
|