DO $$DECLARE this_version CONSTANT varchar := '00.01.069'; BEGIN PERFORM * FROM "DBVersion" WHERE version = this_version; IF FOUND THEN RETURN; END IF; ALTER TABLE public."DescriptionTemplate" ADD COLUMN code character varying(200); UPDATE public."DescriptionTemplate" SET code = uuid_generate_v4(); ALTER TABLE public."DescriptionTemplate" ALTER COLUMN code SET NOT NULL; INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.069', '2024-07-26 12:00:00.000000+02', now(), 'Add DescriptionTemplate code column.'); END$$;