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

       ALTER TABLE public."EmailMessages" ADD "HasThreadAttachments" boolean DEFAULT false;

        EXCEPTION
            WHEN OTHERS THEN RAISE NOTICE 'Alter HasThreadAttachments to table EmailMessages error.';
        END;
    END;
$$

