DO $$DECLARE
   this_version CONSTANT varchar := '00.01.071';
BEGIN
   PERFORM * FROM "DBVersion" WHERE version = this_version;
   IF FOUND THEN RETURN; END IF;

	ALTER TABLE public."PlanBlueprint" ADD COLUMN code character varying(200);
   UPDATE public."PlanBlueprint" SET code = group_id;
   ALTER TABLE public."PlanBlueprint" ALTER COLUMN code SET NOT NULL;
   
    INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.071', '2024-07-29 12:00:00.000000+02', now(), 'Add PlanBlueprint code column.');

END$$;