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

       
	ALTER TABLE public."EmailMessages" ADD "ThreadCount" INT NULL;

        EXCEPTION
            WHEN OTHERS THEN RAISE NOTICE 'ALTER ThreadCount to table EmailMessages error.';
        END;
    END;
$$
