DO $$ 
    BEGIN
          IF EXISTS (SELECT "Id" FROM public."Versions" WHERE "Build">=1765) THEN
		RETURN;
          END IF;
        BEGIN
         CREATE TABLE public."UserMetrics"
(
	"Id" bigserial NOT NULL,
	"UserId" bigint NOT NULL,
	"FilesCount" int NOT NULL,
	"DocumentsCount" int NOT NULL,
	"UsedMemory" bigint NOT NULL,
	"QuotaId" bigint,
	PRIMARY KEY ("UserId")
);
        EXCEPTION
            WHEN duplicate_table THEN RAISE NOTICE 'Create table <UserMetrics>.';
        END;
    END;
$$



