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

        BEGIN
 		CREATE TABLE public."UserActivityStatistics"
		(
			"Date"			timestamp without time zone,
			"CustomerId"	integer NOT NULL,
			"Visitors"		integer NOT NULL,
			"Auths"			integer NOT NULL,
			"Documents"		integer NOT NULL,
			"Files"			integer NOT NULL,
			PRIMARY KEY ("Date","CustomerId")
		);

        EXCEPTION
            WHEN OTHERS THEN RAISE NOTICE 'Table <UserActivityStatistics> is exists.';
        END;
    END;
$$


