DO $$ 
    BEGIN
        BEGIN
          IF EXISTS (SELECT "Id" FROM public."Versions" WHERE "Build">=1765) THEN
		RETURN;
          END IF;
            CREATE INDEX "IDX_DocumentVersions_DocumentId"
                ON public."DocumentVersions" USING btree
                ("DocumentId" ASC NULLS LAST)
                TABLESPACE pg_default;  
        EXCEPTION
            WHEN duplicate_table THEN RAISE NOTICE 'Index IDX_DocumentVersions_DocumentId already exists in <DocumentVersions>.';
        END;
    END;
$$





