DO $$
	BEGIN
		IF EXISTS (SELECT "Id" FROM public."Versions" WHERE "Build">=3008) THEN
			RETURN;
	END IF;

	BEGIN

		INSERT INTO public."Applications"("Key", "Name")
		SELECT 'contacts',  'АРМ Контакты' WHERE NOT EXISTS(SELECT "Key" FROM public."Applications" WHERE "Key"='contacts');
		
		EXCEPTION
			WHEN OTHERS THEN RAISE NOTICE 'Add contacts application error.';
		END;
	END;
$$