DO $$ 
    BEGIN
          IF EXISTS (SELECT "Id" FROM public."Versions" WHERE "Build">=1765) THEN
		RETURN;
          END IF;
        BEGIN
 		ALTER TABLE public."DocumentDirectories"  ADD   "HasShare" boolean DEFAULT false;
		UPDATE public."DocumentDirectories" SET "HasShare"=True WHERE "Id" IN(select "EntityId" FROM  public."SharedLinks"  WHERE  "EntityType" =3);

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

