DO $$ 
    BEGIN
        BEGIN
          IF EXISTS (SELECT "Id" FROM public."Versions" WHERE "Build">=1765) THEN
		RETURN;
          END IF;
 		INSERT INTO public."Applications"("Key", "Name")
		SELECT 'draw',  'АРМ Графика' WHERE NOT EXISTS(SELECT "Key" FROM public."Applications" WHERE "Key"='draw');

        EXCEPTION
            WHEN OTHERS THEN RAISE NOTICE 'insert <draw> in <Applications> error.';
        END;
    END;
$$
