Improve chart engine (#8253)
* wip * wip * wip * wip * wip * wip * wip * Update core.ts * wip * wip * #7361 * delete network chart * federationChart強化 apRequestChart追加 * tweak
This commit is contained in:
parent
0b462feff6
commit
c1b264e4e9
|
@ -0,0 +1,63 @@
|
||||||
|
const { MigrationInterface, QueryRunner } = require("typeorm");
|
||||||
|
|
||||||
|
module.exports = class chartV41643963705770 {
|
||||||
|
name = 'chartV41643963705770'
|
||||||
|
|
||||||
|
async up(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" DROP COLUMN "___drive_totalUsage"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" DROP COLUMN "___drive_totalUsage"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" DROP COLUMN "___local_totalCount"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" DROP COLUMN "___local_totalSize"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" DROP COLUMN "___remote_totalCount"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" DROP COLUMN "___remote_totalSize"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" DROP COLUMN "___local_totalCount"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" DROP COLUMN "___local_totalSize"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" DROP COLUMN "___remote_totalCount"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" DROP COLUMN "___remote_totalSize"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "___local_users"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "___local_users" bigint NOT NULL DEFAULT 0`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "___remote_users"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "___remote_users" bigint NOT NULL DEFAULT 0`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "___local_users"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "___local_users" bigint NOT NULL DEFAULT 0`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "___remote_users"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "___remote_users" bigint NOT NULL DEFAULT 0`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__hashtag" DROP COLUMN "___local_users"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__hashtag" ADD "___local_users" bigint NOT NULL DEFAULT 0`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__hashtag" DROP COLUMN "___remote_users"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__hashtag" ADD "___remote_users" bigint NOT NULL DEFAULT 0`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__hashtag" DROP COLUMN "___local_users"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__hashtag" ADD "___local_users" bigint NOT NULL DEFAULT 0`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__hashtag" DROP COLUMN "___remote_users"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__hashtag" ADD "___remote_users" bigint NOT NULL DEFAULT 0`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async down(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__hashtag" DROP COLUMN "___remote_users"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__hashtag" ADD "___remote_users" character varying array NOT NULL`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__hashtag" DROP COLUMN "___local_users"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__hashtag" ADD "___local_users" character varying array NOT NULL`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__hashtag" DROP COLUMN "___remote_users"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__hashtag" ADD "___remote_users" character varying array NOT NULL`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__hashtag" DROP COLUMN "___local_users"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__hashtag" ADD "___local_users" character varying array NOT NULL`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "___remote_users"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "___remote_users" character varying array NOT NULL`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "___local_users"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "___local_users" character varying array NOT NULL`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "___remote_users"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "___remote_users" character varying array NOT NULL`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "___local_users"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "___local_users" character varying array NOT NULL`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ADD "___remote_totalSize" bigint NOT NULL`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ADD "___remote_totalCount" bigint NOT NULL`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ADD "___local_totalSize" bigint NOT NULL`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ADD "___local_totalCount" bigint NOT NULL`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ADD "___remote_totalSize" bigint NOT NULL`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ADD "___remote_totalCount" bigint NOT NULL`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ADD "___local_totalSize" bigint NOT NULL`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ADD "___local_totalCount" bigint NOT NULL`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ADD "___drive_totalUsage" bigint NOT NULL`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ADD "___drive_totalUsage" bigint NOT NULL`);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
const { MigrationInterface, QueryRunner } = require("typeorm");
|
||||||
|
|
||||||
|
module.exports = class chartV51643966656277 {
|
||||||
|
name = 'chartV51643966656277'
|
||||||
|
|
||||||
|
async up(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "unique_temp___local_users" character varying array NOT NULL DEFAULT '{}'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__active_users" ADD "unique_temp___remote_users" character varying array NOT NULL DEFAULT '{}'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "unique_temp___local_users" character varying array NOT NULL DEFAULT '{}'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ADD "unique_temp___remote_users" character varying array NOT NULL DEFAULT '{}'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__hashtag" ADD "unique_temp___local_users" character varying array NOT NULL DEFAULT '{}'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__hashtag" ADD "unique_temp___remote_users" character varying array NOT NULL DEFAULT '{}'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__hashtag" ADD "unique_temp___local_users" character varying array NOT NULL DEFAULT '{}'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__hashtag" ADD "unique_temp___remote_users" character varying array NOT NULL DEFAULT '{}'`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async down(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__hashtag" DROP COLUMN "unique_temp___remote_users"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__hashtag" DROP COLUMN "unique_temp___local_users"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__hashtag" DROP COLUMN "unique_temp___remote_users"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__hashtag" DROP COLUMN "unique_temp___local_users"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___remote_users"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__active_users" DROP COLUMN "unique_temp___local_users"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___remote_users"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__active_users" DROP COLUMN "unique_temp___local_users"`);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,343 @@
|
||||||
|
const { MigrationInterface, QueryRunner } = require("typeorm");
|
||||||
|
|
||||||
|
module.exports = class chartV61643967331284 {
|
||||||
|
name = 'chartV61643967331284'
|
||||||
|
|
||||||
|
async up(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_total" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_inc" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_dec" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_total" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_inc" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_dec" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_total" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_inc" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_dec" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_normal" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_reply" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_renote" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_total" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_inc" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_dec" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_normal" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_reply" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_renote" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_total" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_inc" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_dec" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_normal" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_reply" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_renote" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_total" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_inc" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_dec" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_normal" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_reply" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_renote" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___local_total" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___local_inc" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___local_dec" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___remote_total" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___remote_inc" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___remote_dec" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_total" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_inc" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_dec" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_total" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_inc" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_dec" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___incomingRequests" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___outgoingRequests" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___totalTime" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___incomingBytes" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___outgoingBytes" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___incomingRequests" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___outgoingRequests" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___totalTime" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___incomingBytes" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___outgoingBytes" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_failed" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_succeeded" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_received" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_total" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_inc" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_dec" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_normal" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_reply" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_renote" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___users_total" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___users_inc" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___users_dec" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___following_total" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___following_inc" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___following_dec" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_total" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_inc" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_dec" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_totalFiles" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_incFiles" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_decFiles" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_incUsage" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_decUsage" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_failed" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_succeeded" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_received" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_total" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_inc" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_dec" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_normal" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_reply" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_renote" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_total" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_inc" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_dec" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_total" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_inc" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_dec" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_total" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_inc" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_dec" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_totalFiles" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_incFiles" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_decFiles" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_incUsage" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_decUsage" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___total" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___inc" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___dec" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_normal" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_reply" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_renote" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___total" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___inc" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___dec" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_normal" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_reply" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_renote" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___local_incCount" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___local_incSize" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___local_decCount" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___local_decSize" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_incCount" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_incSize" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_decCount" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_decSize" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_incCount" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_incSize" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_decCount" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_decSize" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_incCount" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_incSize" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_decCount" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_decSize" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_reaction" ALTER COLUMN "___local_count" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_reaction" ALTER COLUMN "___remote_count" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_reaction" ALTER COLUMN "___local_count" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_reaction" ALTER COLUMN "___remote_count" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_total" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_inc" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_dec" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_total" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_inc" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_dec" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_total" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_inc" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_dec" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_total" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_inc" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_dec" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_total" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_inc" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_dec" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_total" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_inc" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_dec" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_total" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_inc" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_dec" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_total" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_inc" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_dec" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___totalCount" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___totalSize" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___incCount" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___incSize" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___decCount" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___decSize" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___totalCount" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___totalSize" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___incCount" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___incSize" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___decCount" SET DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___decSize" SET DEFAULT '0'`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async down(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___decSize" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___decCount" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___incSize" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___incCount" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___totalSize" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___totalCount" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___decSize" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___decCount" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___incSize" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___incCount" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___totalSize" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___totalCount" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_dec" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_inc" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_total" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_dec" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_inc" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_total" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_dec" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_inc" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_total" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_dec" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_inc" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_total" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_dec" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_inc" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_total" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_dec" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_inc" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_total" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_dec" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_inc" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_total" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_dec" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_inc" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_total" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_reaction" ALTER COLUMN "___remote_count" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_reaction" ALTER COLUMN "___local_count" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_reaction" ALTER COLUMN "___remote_count" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_reaction" ALTER COLUMN "___local_count" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_decSize" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_decCount" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_incSize" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_incCount" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_decSize" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_decCount" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_incSize" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_incCount" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_decSize" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_decCount" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_incSize" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_incCount" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___local_decSize" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___local_decCount" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___local_incSize" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___local_incCount" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_renote" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_reply" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_normal" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___dec" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___inc" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___total" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_renote" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_reply" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_normal" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___dec" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___inc" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___total" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_decUsage" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_incUsage" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_decFiles" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_incFiles" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_totalFiles" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_dec" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_inc" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_total" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_dec" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_inc" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_total" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_dec" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_inc" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_total" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_renote" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_reply" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_normal" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_dec" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_inc" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_total" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_received" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_succeeded" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_failed" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_decUsage" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_incUsage" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_decFiles" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_incFiles" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_totalFiles" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_dec" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_inc" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_total" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___following_dec" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___following_inc" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___following_total" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___users_dec" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___users_inc" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___users_total" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_renote" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_reply" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_normal" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_dec" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_inc" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_total" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_received" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_succeeded" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_failed" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___outgoingBytes" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___incomingBytes" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___totalTime" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___outgoingRequests" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___incomingRequests" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___outgoingBytes" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___incomingBytes" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___totalTime" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___outgoingRequests" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___incomingRequests" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_dec" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_inc" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_total" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_dec" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_inc" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_total" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___remote_dec" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___remote_inc" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___remote_total" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___local_dec" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___local_inc" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___local_total" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_renote" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_reply" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_normal" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_dec" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_inc" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_total" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_renote" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_reply" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_normal" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_dec" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_inc" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_total" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_renote" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_reply" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_normal" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_dec" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_inc" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_total" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_renote" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_reply" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_normal" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_dec" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_inc" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_total" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_dec" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_inc" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_total" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_dec" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_inc" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_total" DROP DEFAULT`);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,511 @@
|
||||||
|
const { MigrationInterface, QueryRunner } = require("typeorm");
|
||||||
|
|
||||||
|
module.exports = class chartV71644058404077 {
|
||||||
|
name = 'chartV71644058404077'
|
||||||
|
|
||||||
|
async up(queryRunner) {
|
||||||
|
await queryRunner.query(`UPDATE "__chart__federation" SET "___instance_total"=2147483647 WHERE "___instance_total" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__federation" SET "___instance_inc"=32767 WHERE "___instance_inc" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__federation" SET "___instance_dec"=32767 WHERE "___instance_dec" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__federation" SET "___instance_total"=2147483647 WHERE "___instance_total" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__federation" SET "___instance_inc"=32767 WHERE "___instance_inc" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__federation" SET "___instance_dec"=32767 WHERE "___instance_dec" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__notes" SET "___local_total"=2147483647 WHERE "___local_total" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__notes" SET "___local_inc"=2147483647 WHERE "___local_inc" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__notes" SET "___local_dec"=2147483647 WHERE "___local_dec" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__notes" SET "___local_diffs_normal"=2147483647 WHERE "___local_diffs_normal" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__notes" SET "___local_diffs_reply"=2147483647 WHERE "___local_diffs_reply" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__notes" SET "___local_diffs_renote"=2147483647 WHERE "___local_diffs_renote" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__notes" SET "___remote_total"=2147483647 WHERE "___remote_total" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__notes" SET "___remote_inc"=2147483647 WHERE "___remote_inc" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__notes" SET "___remote_dec"=2147483647 WHERE "___remote_dec" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__notes" SET "___remote_diffs_normal"=2147483647 WHERE "___remote_diffs_normal" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__notes" SET "___remote_diffs_reply"=2147483647 WHERE "___remote_diffs_reply" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__notes" SET "___remote_diffs_renote"=2147483647 WHERE "___remote_diffs_renote" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__notes" SET "___local_total"=2147483647 WHERE "___local_total" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__notes" SET "___local_inc"=2147483647 WHERE "___local_inc" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__notes" SET "___local_dec"=2147483647 WHERE "___local_dec" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__notes" SET "___local_diffs_normal"=2147483647 WHERE "___local_diffs_normal" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__notes" SET "___local_diffs_reply"=2147483647 WHERE "___local_diffs_reply" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__notes" SET "___local_diffs_renote"=2147483647 WHERE "___local_diffs_renote" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__notes" SET "___remote_total"=2147483647 WHERE "___remote_total" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__notes" SET "___remote_inc"=2147483647 WHERE "___remote_inc" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__notes" SET "___remote_dec"=2147483647 WHERE "___remote_dec" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__notes" SET "___remote_diffs_normal"=2147483647 WHERE "___remote_diffs_normal" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__notes" SET "___remote_diffs_reply"=2147483647 WHERE "___remote_diffs_reply" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__notes" SET "___remote_diffs_renote"=2147483647 WHERE "___remote_diffs_renote" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__users" SET "___local_total"=2147483647 WHERE "___local_total" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__users" SET "___local_inc"=32767 WHERE "___local_inc" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__users" SET "___local_dec"=32767 WHERE "___local_dec" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__users" SET "___remote_total"=2147483647 WHERE "___remote_total" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__users" SET "___remote_inc"=32767 WHERE "___remote_inc" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__users" SET "___remote_dec"=32767 WHERE "___remote_dec" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__users" SET "___local_total"=2147483647 WHERE "___local_total" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__users" SET "___local_inc"=32767 WHERE "___local_inc" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__users" SET "___local_dec"=32767 WHERE "___local_dec" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__users" SET "___remote_total"=2147483647 WHERE "___remote_total" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__users" SET "___remote_inc"=32767 WHERE "___remote_inc" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__users" SET "___remote_dec"=32767 WHERE "___remote_dec" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__network" SET "___incomingRequests"=2147483647 WHERE "___incomingRequests" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__network" SET "___outgoingRequests"=2147483647 WHERE "___outgoingRequests" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__network" SET "___totalTime"=2147483647 WHERE "___totalTime" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__network" SET "___incomingBytes"=2147483647 WHERE "___incomingBytes" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__network" SET "___outgoingBytes"=2147483647 WHERE "___outgoingBytes" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__network" SET "___incomingRequests"=2147483647 WHERE "___incomingRequests" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__network" SET "___outgoingRequests"=2147483647 WHERE "___outgoingRequests" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__network" SET "___totalTime"=2147483647 WHERE "___totalTime" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__network" SET "___incomingBytes"=2147483647 WHERE "___incomingBytes" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__network" SET "___outgoingBytes"=2147483647 WHERE "___outgoingBytes" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__instance" SET "___requests_failed"=32767 WHERE "___requests_failed" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__instance" SET "___requests_succeeded"=32767 WHERE "___requests_succeeded" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__instance" SET "___requests_received"=32767 WHERE "___requests_received" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__instance" SET "___notes_total"=2147483647 WHERE "___notes_total" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__instance" SET "___notes_inc"=2147483647 WHERE "___notes_inc" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__instance" SET "___notes_dec"=2147483647 WHERE "___notes_dec" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__instance" SET "___notes_diffs_normal"=2147483647 WHERE "___notes_diffs_normal" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__instance" SET "___notes_diffs_reply"=2147483647 WHERE "___notes_diffs_reply" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__instance" SET "___notes_diffs_renote"=2147483647 WHERE "___notes_diffs_renote" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__instance" SET "___users_total"=2147483647 WHERE "___users_total" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__instance" SET "___users_inc"=32767 WHERE "___users_inc" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__instance" SET "___users_dec"=32767 WHERE "___users_dec" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__instance" SET "___following_total"=2147483647 WHERE "___following_total" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__instance" SET "___following_inc"=32767 WHERE "___following_inc" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__instance" SET "___following_dec"=32767 WHERE "___following_dec" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__instance" SET "___followers_total"=2147483647 WHERE "___followers_total" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__instance" SET "___followers_inc"=32767 WHERE "___followers_inc" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__instance" SET "___followers_dec"=32767 WHERE "___followers_dec" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__instance" SET "___drive_totalFiles"=2147483647 WHERE "___drive_totalFiles" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__instance" SET "___drive_incFiles"=2147483647 WHERE "___drive_incFiles" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__instance" SET "___drive_decFiles"=2147483647 WHERE "___drive_decFiles" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__instance" SET "___drive_incUsage"=2147483647 WHERE "___drive_incUsage" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__instance" SET "___drive_decUsage"=2147483647 WHERE "___drive_decUsage" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__instance" SET "___requests_failed"=32767 WHERE "___requests_failed" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__instance" SET "___requests_succeeded"=32767 WHERE "___requests_succeeded" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__instance" SET "___requests_received"=32767 WHERE "___requests_received" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__instance" SET "___notes_total"=2147483647 WHERE "___notes_total" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__instance" SET "___notes_inc"=2147483647 WHERE "___notes_inc" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__instance" SET "___notes_dec"=2147483647 WHERE "___notes_dec" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__instance" SET "___notes_diffs_normal"=2147483647 WHERE "___notes_diffs_normal" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__instance" SET "___notes_diffs_reply"=2147483647 WHERE "___notes_diffs_reply" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__instance" SET "___notes_diffs_renote"=2147483647 WHERE "___notes_diffs_renote" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__instance" SET "___users_total"=2147483647 WHERE "___users_total" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__instance" SET "___users_inc"=32767 WHERE "___users_inc" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__instance" SET "___users_dec"=32767 WHERE "___users_dec" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__instance" SET "___following_total"=2147483647 WHERE "___following_total" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__instance" SET "___following_inc"=32767 WHERE "___following_inc" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__instance" SET "___following_dec"=32767 WHERE "___following_dec" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__instance" SET "___followers_total"=2147483647 WHERE "___followers_total" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__instance" SET "___followers_inc"=32767 WHERE "___followers_inc" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__instance" SET "___followers_dec"=32767 WHERE "___followers_dec" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__instance" SET "___drive_totalFiles"=2147483647 WHERE "___drive_totalFiles" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__instance" SET "___drive_incFiles"=2147483647 WHERE "___drive_incFiles" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__instance" SET "___drive_decFiles"=2147483647 WHERE "___drive_decFiles" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__instance" SET "___drive_incUsage"=2147483647 WHERE "___drive_incUsage" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__instance" SET "___drive_decUsage"=2147483647 WHERE "___drive_decUsage" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__per_user_notes" SET "___total"=2147483647 WHERE "___total" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__per_user_notes" SET "___inc"=32767 WHERE "___inc" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__per_user_notes" SET "___dec"=32767 WHERE "___dec" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__per_user_notes" SET "___diffs_normal"=32767 WHERE "___diffs_normal" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__per_user_notes" SET "___diffs_reply"=32767 WHERE "___diffs_reply" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__per_user_notes" SET "___diffs_renote"=32767 WHERE "___diffs_renote" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__per_user_notes" SET "___total"=2147483647 WHERE "___total" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__per_user_notes" SET "___inc"=32767 WHERE "___inc" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__per_user_notes" SET "___dec"=32767 WHERE "___dec" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__per_user_notes" SET "___diffs_normal"=32767 WHERE "___diffs_normal" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__per_user_notes" SET "___diffs_reply"=32767 WHERE "___diffs_reply" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__per_user_notes" SET "___diffs_renote"=32767 WHERE "___diffs_renote" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__drive" SET "___local_incCount"=2147483647 WHERE "___local_incCount" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__drive" SET "___local_incSize"=2147483647 WHERE "___local_incSize" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__drive" SET "___local_decCount"=2147483647 WHERE "___local_decCount" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__drive" SET "___local_decSize"=2147483647 WHERE "___local_decSize" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__drive" SET "___remote_incCount"=2147483647 WHERE "___remote_incCount" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__drive" SET "___remote_incSize"=2147483647 WHERE "___remote_incSize" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__drive" SET "___remote_decCount"=2147483647 WHERE "___remote_decCount" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__drive" SET "___remote_decSize"=2147483647 WHERE "___remote_decSize" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__drive" SET "___local_incCount"=2147483647 WHERE "___local_incCount" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__drive" SET "___local_incSize"=2147483647 WHERE "___local_incSize" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__drive" SET "___local_decCount"=2147483647 WHERE "___local_decCount" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__drive" SET "___local_decSize"=2147483647 WHERE "___local_decSize" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__drive" SET "___remote_incCount"=2147483647 WHERE "___remote_incCount" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__drive" SET "___remote_incSize"=2147483647 WHERE "___remote_incSize" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__drive" SET "___remote_decCount"=2147483647 WHERE "___remote_decCount" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__drive" SET "___remote_decSize"=2147483647 WHERE "___remote_decSize" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__per_user_reaction" SET "___local_count"=32767 WHERE "___local_count" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__per_user_reaction" SET "___remote_count"=32767 WHERE "___remote_count" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__per_user_reaction" SET "___local_count"=32767 WHERE "___local_count" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__per_user_reaction" SET "___remote_count"=32767 WHERE "___remote_count" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__per_user_following" SET "___local_followings_total"=2147483647 WHERE "___local_followings_total" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__per_user_following" SET "___local_followings_inc"=32767 WHERE "___local_followings_inc" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__per_user_following" SET "___local_followings_dec"=32767 WHERE "___local_followings_dec" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__per_user_following" SET "___local_followers_total"=2147483647 WHERE "___local_followers_total" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__per_user_following" SET "___local_followers_inc"=32767 WHERE "___local_followers_inc" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__per_user_following" SET "___local_followers_dec"=32767 WHERE "___local_followers_dec" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__per_user_following" SET "___remote_followings_total"=2147483647 WHERE "___remote_followings_total" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__per_user_following" SET "___remote_followings_inc"=32767 WHERE "___remote_followings_inc" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__per_user_following" SET "___remote_followings_dec"=32767 WHERE "___remote_followings_dec" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__per_user_following" SET "___remote_followers_total"=2147483647 WHERE "___remote_followers_total" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__per_user_following" SET "___remote_followers_inc"=32767 WHERE "___remote_followers_inc" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__per_user_following" SET "___remote_followers_dec"=32767 WHERE "___remote_followers_dec" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__per_user_following" SET "___local_followings_total"=2147483647 WHERE "___local_followings_total" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__per_user_following" SET "___local_followings_inc"=32767 WHERE "___local_followings_inc" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__per_user_following" SET "___local_followings_dec"=32767 WHERE "___local_followings_dec" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__per_user_following" SET "___local_followers_total"=2147483647 WHERE "___local_followers_total" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__per_user_following" SET "___local_followers_inc"=32767 WHERE "___local_followers_inc" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__per_user_following" SET "___local_followers_dec"=32767 WHERE "___local_followers_dec" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__per_user_following" SET "___remote_followings_total"=2147483647 WHERE "___remote_followings_total" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__per_user_following" SET "___remote_followings_inc"=32767 WHERE "___remote_followings_inc" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__per_user_following" SET "___remote_followings_dec"=32767 WHERE "___remote_followings_dec" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__per_user_following" SET "___remote_followers_total"=2147483647 WHERE "___remote_followers_total" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__per_user_following" SET "___remote_followers_inc"=32767 WHERE "___remote_followers_inc" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__per_user_following" SET "___remote_followers_dec"=32767 WHERE "___remote_followers_dec" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__per_user_drive" SET "___totalCount"=2147483647 WHERE "___totalCount" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__per_user_drive" SET "___totalSize"=2147483647 WHERE "___totalSize" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__per_user_drive" SET "___incCount"=32767 WHERE "___incCount" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__per_user_drive" SET "___incSize"=2147483647 WHERE "___incSize" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__per_user_drive" SET "___decCount"=32767 WHERE "___decCount" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__per_user_drive" SET "___decSize"=2147483647 WHERE "___decSize" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__per_user_drive" SET "___totalCount"=2147483647 WHERE "___totalCount" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__per_user_drive" SET "___totalSize"=2147483647 WHERE "___totalSize" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__per_user_drive" SET "___incCount"=32767 WHERE "___incCount" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__per_user_drive" SET "___incSize"=2147483647 WHERE "___incSize" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__per_user_drive" SET "___decCount"=32767 WHERE "___decCount" > 32767`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__per_user_drive" SET "___decSize"=2147483647 WHERE "___decSize" > 2147483647`);
|
||||||
|
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_total" TYPE integer USING "___instance_total"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_inc" TYPE smallint USING "___instance_inc"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_dec" TYPE smallint USING "___instance_dec"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_total" TYPE integer USING "___instance_total"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_inc" TYPE smallint USING "___instance_inc"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_dec" TYPE smallint USING "___instance_dec"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_total" TYPE integer USING "___local_total"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_inc" TYPE integer USING "___local_inc"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_dec" TYPE integer USING "___local_dec"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_normal" TYPE integer USING "___local_diffs_normal"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_reply" TYPE integer USING "___local_diffs_reply"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_renote" TYPE integer USING "___local_diffs_renote"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_total" TYPE integer USING "___remote_total"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_inc" TYPE integer USING "___remote_inc"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_dec" TYPE integer USING "___remote_dec"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_normal" TYPE integer USING "___remote_diffs_normal"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_reply" TYPE integer USING "___remote_diffs_reply"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_renote" TYPE integer USING "___remote_diffs_renote"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_total" TYPE integer USING "___local_total"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_inc" TYPE integer USING "___local_inc"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_dec" TYPE integer USING "___local_dec"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_normal" TYPE integer USING "___local_diffs_normal"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_reply" TYPE integer USING "___local_diffs_reply"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_renote" TYPE integer USING "___local_diffs_renote"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_total" TYPE integer USING "___remote_total"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_inc" TYPE integer USING "___remote_inc"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_dec" TYPE integer USING "___remote_dec"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_normal" TYPE integer USING "___remote_diffs_normal"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_reply" TYPE integer USING "___remote_diffs_reply"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_renote" TYPE integer USING "___remote_diffs_renote"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___local_total" TYPE integer USING "___local_total"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___local_inc" TYPE smallint USING "___local_inc"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___local_dec" TYPE smallint USING "___local_dec"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___remote_total" TYPE integer USING "___remote_total"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___remote_inc" TYPE smallint USING "___remote_inc"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___remote_dec" TYPE smallint USING "___remote_dec"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_total" TYPE integer USING "___local_total"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_inc" TYPE smallint USING "___local_inc"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_dec" TYPE smallint USING "___local_dec"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_total" TYPE integer USING "___remote_total"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_inc" TYPE smallint USING "___remote_inc"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_dec" TYPE smallint USING "___remote_dec"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___incomingRequests" TYPE integer USING "___incomingRequests"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___outgoingRequests" TYPE integer USING "___outgoingRequests"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___totalTime" TYPE integer USING "___totalTime"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___incomingBytes" TYPE integer USING "___incomingBytes"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___outgoingBytes" TYPE integer USING "___outgoingBytes"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___incomingRequests" TYPE integer USING "___incomingRequests"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___outgoingRequests" TYPE integer USING "___outgoingRequests"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___totalTime" TYPE integer USING "___totalTime"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___incomingBytes" TYPE integer USING "___incomingBytes"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___outgoingBytes" TYPE integer USING "___outgoingBytes"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_failed" TYPE smallint USING "___requests_failed"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_succeeded" TYPE smallint USING "___requests_succeeded"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_received" TYPE smallint USING "___requests_received"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_total" TYPE integer USING "___notes_total"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_inc" TYPE integer USING "___notes_inc"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_dec" TYPE integer USING "___notes_dec"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_normal" TYPE integer USING "___notes_diffs_normal"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_reply" TYPE integer USING "___notes_diffs_reply"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_renote" TYPE integer USING "___notes_diffs_renote"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___users_total" TYPE integer USING "___users_total"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___users_inc" TYPE smallint USING "___users_inc"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___users_dec" TYPE smallint USING "___users_dec"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___following_total" TYPE integer USING "___following_total"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___following_inc" TYPE smallint USING "___following_inc"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___following_dec" TYPE smallint USING "___following_dec"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_total" TYPE integer USING "___followers_total"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_inc" TYPE smallint USING "___followers_inc"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_dec" TYPE smallint USING "___followers_dec"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_totalFiles" TYPE integer USING "___drive_totalFiles"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_incFiles" TYPE integer USING "___drive_incFiles"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_decFiles" TYPE integer USING "___drive_decFiles"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_incUsage" TYPE integer USING "___drive_incUsage"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_decUsage" TYPE integer USING "___drive_decUsage"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_failed" TYPE smallint USING "___requests_failed"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_succeeded" TYPE smallint USING "___requests_succeeded"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_received" TYPE smallint USING "___requests_received"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_total" TYPE integer USING "___notes_total"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_inc" TYPE integer USING "___notes_inc"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_dec" TYPE integer USING "___notes_dec"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_normal" TYPE integer USING "___notes_diffs_normal"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_reply" TYPE integer USING "___notes_diffs_reply"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_renote" TYPE integer USING "___notes_diffs_renote"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_total" TYPE integer USING "___users_total"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_inc" TYPE smallint USING "___users_inc"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_dec" TYPE smallint USING "___users_dec"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_total" TYPE integer USING "___following_total"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_inc" TYPE smallint USING "___following_inc"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_dec" TYPE smallint USING "___following_dec"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_total" TYPE integer USING "___followers_total"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_inc" TYPE smallint USING "___followers_inc"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_dec" TYPE smallint USING "___followers_dec"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_totalFiles" TYPE integer USING "___drive_totalFiles"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_incFiles" TYPE integer USING "___drive_incFiles"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_decFiles" TYPE integer USING "___drive_decFiles"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_incUsage" TYPE integer USING "___drive_incUsage"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_decUsage" TYPE integer USING "___drive_decUsage"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___total" TYPE integer USING "___total"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___inc" TYPE smallint USING "___inc"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___dec" TYPE smallint USING "___dec"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_normal" TYPE smallint USING "___diffs_normal"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_reply" TYPE smallint USING "___diffs_reply"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_renote" TYPE smallint USING "___diffs_renote"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___total" TYPE integer USING "___total"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___inc" TYPE smallint USING "___inc"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___dec" TYPE smallint USING "___dec"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_normal" TYPE smallint USING "___diffs_normal"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_reply" TYPE smallint USING "___diffs_reply"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_renote" TYPE smallint USING "___diffs_renote"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___local_incCount" TYPE integer USING "___local_incCount"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___local_incSize" TYPE integer USING "___local_incSize"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___local_decCount" TYPE integer USING "___local_decCount"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___local_decSize" TYPE integer USING "___local_decSize"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_incCount" TYPE integer USING "___remote_incCount"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_incSize" TYPE integer USING "___remote_incSize"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_decCount" TYPE integer USING "___remote_decCount"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_decSize" TYPE integer USING "___remote_decSize"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_incCount" TYPE integer USING "___local_incCount"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_incSize" TYPE integer USING "___local_incSize"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_decCount" TYPE integer USING "___local_decCount"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_decSize" TYPE integer USING "___local_decSize"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_incCount" TYPE integer USING "___remote_incCount"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_incSize" TYPE integer USING "___remote_incSize"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_decCount" TYPE integer USING "___remote_decCount"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_decSize" TYPE integer USING "___remote_decSize"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_reaction" ALTER COLUMN "___local_count" TYPE smallint USING "___local_count"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_reaction" ALTER COLUMN "___remote_count" TYPE smallint USING "___remote_count"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_reaction" ALTER COLUMN "___local_count" TYPE smallint USING "___local_count"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_reaction" ALTER COLUMN "___remote_count" TYPE smallint USING "___remote_count"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_total" TYPE integer USING "___local_followings_total"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_inc" TYPE smallint USING "___local_followings_inc"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_dec" TYPE smallint USING "___local_followings_dec"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_total" TYPE integer USING "___local_followers_total"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_inc" TYPE smallint USING "___local_followers_inc"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_dec" TYPE smallint USING "___local_followers_dec"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_total" TYPE integer USING "___remote_followings_total"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_inc" TYPE smallint USING "___remote_followings_inc"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_dec" TYPE smallint USING "___remote_followings_dec"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_total" TYPE integer USING "___remote_followers_total"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_inc" TYPE smallint USING "___remote_followers_inc"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_dec" TYPE smallint USING "___remote_followers_dec"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_total" TYPE integer USING "___local_followings_total"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_inc" TYPE smallint USING "___local_followings_inc"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_dec" TYPE smallint USING "___local_followings_dec"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_total" TYPE integer USING "___local_followers_total"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_inc" TYPE smallint USING "___local_followers_inc"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_dec" TYPE smallint USING "___local_followers_dec"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_total" TYPE integer USING "___remote_followings_total"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_inc" TYPE smallint USING "___remote_followings_inc"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_dec" TYPE smallint USING "___remote_followings_dec"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_total" TYPE integer USING "___remote_followers_total"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_inc" TYPE smallint USING "___remote_followers_inc"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_dec" TYPE smallint USING "___remote_followers_dec"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___totalCount" TYPE integer USING "___totalCount"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___totalSize" TYPE integer USING "___totalSize"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___incCount" TYPE smallint USING "___incCount"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___incSize" TYPE integer USING "___incSize"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___decCount" TYPE smallint USING "___decCount"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___decSize" TYPE integer USING "___decSize"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___totalCount" TYPE integer USING "___totalCount"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___totalSize" TYPE integer USING "___totalSize"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___incCount" TYPE smallint USING "___incCount"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___incSize" TYPE integer USING "___incSize"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___decCount" TYPE smallint USING "___decCount"::smallint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___decSize" TYPE integer USING "___decSize"::integer`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async down(queryRunner) {
|
||||||
|
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_total" TYPE bigint USING "___instance_total"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_inc" TYPE bigint USING "___instance_inc"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__federation" ALTER COLUMN "___instance_dec" TYPE bigint USING "___instance_dec"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_total" TYPE bigint USING "___instance_total"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_inc" TYPE bigint USING "___instance_inc"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__federation" ALTER COLUMN "___instance_dec" TYPE bigint USING "___instance_dec"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_total" TYPE bigint USING "___local_total"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_inc" TYPE bigint USING "___local_inc"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_dec" TYPE bigint USING "___local_dec"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_normal" TYPE bigint USING "___local_diffs_normal"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_reply" TYPE bigint USING "___local_diffs_reply"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___local_diffs_renote" TYPE bigint USING "___local_diffs_renote"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_total" TYPE bigint USING "___remote_total"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_inc" TYPE bigint USING "___remote_inc"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_dec" TYPE bigint USING "___remote_dec"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_normal" TYPE bigint USING "___remote_diffs_normal"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_reply" TYPE bigint USING "___remote_diffs_reply"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__notes" ALTER COLUMN "___remote_diffs_renote" TYPE bigint USING "___remote_diffs_renote"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_total" TYPE bigint USING "___local_total"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_inc" TYPE bigint USING "___local_inc"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_dec" TYPE bigint USING "___local_dec"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_normal" TYPE bigint USING "___local_diffs_normal"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_reply" TYPE bigint USING "___local_diffs_reply"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___local_diffs_renote" TYPE bigint USING "___local_diffs_renote"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_total" TYPE bigint USING "___remote_total"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_inc" TYPE bigint USING "___remote_inc"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_dec" TYPE bigint USING "___remote_dec"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_normal" TYPE bigint USING "___remote_diffs_normal"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_reply" TYPE bigint USING "___remote_diffs_reply"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__notes" ALTER COLUMN "___remote_diffs_renote" TYPE bigint USING "___remote_diffs_renote"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___local_total" TYPE bigint USING "___local_total"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___local_inc" TYPE bigint USING "___local_inc"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___local_dec" TYPE bigint USING "___local_dec"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___remote_total" TYPE bigint USING "___remote_total"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___remote_inc" TYPE bigint USING "___remote_inc"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__users" ALTER COLUMN "___remote_dec" TYPE bigint USING "___remote_dec"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_total" TYPE bigint USING "___local_total"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_inc" TYPE bigint USING "___local_inc"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___local_dec" TYPE bigint USING "___local_dec"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_total" TYPE bigint USING "___remote_total"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_inc" TYPE bigint USING "___remote_inc"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__users" ALTER COLUMN "___remote_dec" TYPE bigint USING "___remote_dec"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___incomingRequests" TYPE bigint USING "___incomingRequests"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___outgoingRequests" TYPE bigint USING "___outgoingRequests"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___totalTime" TYPE bigint USING "___totalTime"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___incomingBytes" TYPE bigint USING "___incomingBytes"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__network" ALTER COLUMN "___outgoingBytes" TYPE bigint USING "___outgoingBytes"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___incomingRequests" TYPE bigint USING "___incomingRequests"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___outgoingRequests" TYPE bigint USING "___outgoingRequests"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___totalTime" TYPE bigint USING "___totalTime"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___incomingBytes" TYPE bigint USING "___incomingBytes"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__network" ALTER COLUMN "___outgoingBytes" TYPE bigint USING "___outgoingBytes"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_failed" TYPE bigint USING "___requests_failed"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_succeeded" TYPE bigint USING "___requests_succeeded"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___requests_received" TYPE bigint USING "___requests_received"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_total" TYPE bigint USING "___notes_total"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_inc" TYPE bigint USING "___notes_inc"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_dec" TYPE bigint USING "___notes_dec"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_normal" TYPE bigint USING "___notes_diffs_normal"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_reply" TYPE bigint USING "___notes_diffs_reply"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___notes_diffs_renote" TYPE bigint USING "___notes_diffs_renote"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___users_total" TYPE bigint USING "___users_total"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___users_inc" TYPE bigint USING "___users_inc"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___users_dec" TYPE bigint USING "___users_dec"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___following_total" TYPE bigint USING "___following_total"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___following_inc" TYPE bigint USING "___following_inc"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___following_dec" TYPE bigint USING "___following_dec"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_total" TYPE bigint USING "___followers_total"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_inc" TYPE bigint USING "___followers_inc"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___followers_dec" TYPE bigint USING "___followers_dec"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_totalFiles" TYPE bigint USING "___drive_totalFiles"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_incFiles" TYPE bigint USING "___drive_incFiles"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_decFiles" TYPE bigint USING "___drive_decFiles"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_incUsage" TYPE bigint USING "___drive_incUsage"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__instance" ALTER COLUMN "___drive_decUsage" TYPE bigint USING "___drive_decUsage"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_failed" TYPE bigint USING "___requests_failed"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_succeeded" TYPE bigint USING "___requests_succeeded"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___requests_received" TYPE bigint USING "___requests_received"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_total" TYPE bigint USING "___notes_total"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_inc" TYPE bigint USING "___notes_inc"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_dec" TYPE bigint USING "___notes_dec"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_normal" TYPE bigint USING "___notes_diffs_normal"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_reply" TYPE bigint USING "___notes_diffs_reply"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___notes_diffs_renote" TYPE bigint USING "___notes_diffs_renote"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_total" TYPE bigint USING "___users_total"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_inc" TYPE bigint USING "___users_inc"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___users_dec" TYPE bigint USING "___users_dec"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_total" TYPE bigint USING "___following_total"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_inc" TYPE bigint USING "___following_inc"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___following_dec" TYPE bigint USING "___following_dec"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_total" TYPE bigint USING "___followers_total"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_inc" TYPE bigint USING "___followers_inc"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___followers_dec" TYPE bigint USING "___followers_dec"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_totalFiles" TYPE bigint USING "___drive_totalFiles"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_incFiles" TYPE bigint USING "___drive_incFiles"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_decFiles" TYPE bigint USING "___drive_decFiles"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_incUsage" TYPE bigint USING "___drive_incUsage"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__instance" ALTER COLUMN "___drive_decUsage" TYPE bigint USING "___drive_decUsage"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___total" TYPE bigint USING "___total"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___inc" TYPE bigint USING "___inc"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___dec" TYPE bigint USING "___dec"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_normal" TYPE bigint USING "___diffs_normal"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_reply" TYPE bigint USING "___diffs_reply"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_notes" ALTER COLUMN "___diffs_renote" TYPE bigint USING "___diffs_renote"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___total" TYPE bigint USING "___total"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___inc" TYPE bigint USING "___inc"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___dec" TYPE bigint USING "___dec"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_normal" TYPE bigint USING "___diffs_normal"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_reply" TYPE bigint USING "___diffs_reply"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_notes" ALTER COLUMN "___diffs_renote" TYPE bigint USING "___diffs_renote"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___local_incCount" TYPE bigint USING "___local_incCount"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___local_incSize" TYPE bigint USING "___local_incSize"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___local_decCount" TYPE bigint USING "___local_decCount"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___local_decSize" TYPE bigint USING "___local_decSize"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_incCount" TYPE bigint USING "___remote_incCount"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_incSize" TYPE bigint USING "___remote_incSize"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_decCount" TYPE bigint USING "___remote_decCount"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__drive" ALTER COLUMN "___remote_decSize" TYPE bigint USING "___remote_decSize"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_incCount" TYPE bigint USING "___local_incCount"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_incSize" TYPE bigint USING "___local_incSize"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_decCount" TYPE bigint USING "___local_decCount"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___local_decSize" TYPE bigint USING "___local_decSize"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_incCount" TYPE bigint USING "___remote_incCount"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_incSize" TYPE bigint USING "___remote_incSize"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_decCount" TYPE bigint USING "___remote_decCount"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__drive" ALTER COLUMN "___remote_decSize" TYPE bigint USING "___remote_decSize"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_reaction" ALTER COLUMN "___local_count" TYPE bigint USING "___local_count"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_reaction" ALTER COLUMN "___remote_count" TYPE bigint USING "___remote_count"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_reaction" ALTER COLUMN "___local_count" TYPE bigint USING "___local_count"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_reaction" ALTER COLUMN "___remote_count" TYPE bigint USING "___remote_count"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_total" TYPE bigint USING "___local_followings_total"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_inc" TYPE bigint USING "___local_followings_inc"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followings_dec" TYPE bigint USING "___local_followings_dec"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_total" TYPE bigint USING "___local_followers_total"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_inc" TYPE bigint USING "___local_followers_inc"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___local_followers_dec" TYPE bigint USING "___local_followers_dec"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_total" TYPE bigint USING "___remote_followings_total"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_inc" TYPE bigint USING "___remote_followings_inc"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followings_dec" TYPE bigint USING "___remote_followings_dec"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_total" TYPE bigint USING "___remote_followers_total"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_inc" TYPE bigint USING "___remote_followers_inc"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_following" ALTER COLUMN "___remote_followers_dec" TYPE bigint USING "___remote_followers_dec"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_total" TYPE bigint USING "___local_followings_total"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_inc" TYPE bigint USING "___local_followings_inc"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followings_dec" TYPE bigint USING "___local_followings_dec"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_total" TYPE bigint USING "___local_followers_total"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_inc" TYPE bigint USING "___local_followers_inc"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___local_followers_dec" TYPE bigint USING "___local_followers_dec"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_total" TYPE bigint USING "___remote_followings_total"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_inc" TYPE bigint USING "___remote_followings_inc"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followings_dec" TYPE bigint USING "___remote_followings_dec"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_total" TYPE bigint USING "___remote_followers_total"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_inc" TYPE bigint USING "___remote_followers_inc"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_following" ALTER COLUMN "___remote_followers_dec" TYPE bigint USING "___remote_followers_dec"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___totalCount" TYPE bigint USING "___totalCount"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___totalSize" TYPE bigint USING "___totalSize"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___incCount" TYPE bigint USING "___incCount"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___incSize" TYPE bigint USING "___incSize"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___decCount" TYPE bigint USING "___decCount"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__per_user_drive" ALTER COLUMN "___decSize" TYPE bigint USING "___decSize"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___totalCount" TYPE bigint USING "___totalCount"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___totalSize" TYPE bigint USING "___totalSize"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___incCount" TYPE bigint USING "___incCount"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___incSize" TYPE bigint USING "___incSize"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___decCount" TYPE bigint USING "___decCount"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__per_user_drive" ALTER COLUMN "___decSize" TYPE bigint USING "___decSize"::bigint`);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
const { MigrationInterface, QueryRunner } = require("typeorm");
|
||||||
|
|
||||||
|
module.exports = class chartV81644059847460 {
|
||||||
|
name = 'chartV81644059847460'
|
||||||
|
|
||||||
|
async up(queryRunner) {
|
||||||
|
await queryRunner.query(`UPDATE "__chart__active_users" SET "___local_users"=2147483647 WHERE "___local_users" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__active_users" SET "___remote_users"=2147483647 WHERE "___remote_users" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__active_users" SET "___local_users"=2147483647 WHERE "___local_users" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__active_users" SET "___remote_users"=2147483647 WHERE "___remote_users" > 2147483647`);
|
||||||
|
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__active_users" ALTER COLUMN "___local_users" TYPE integer USING "___local_users"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__active_users" ALTER COLUMN "___remote_users" TYPE integer USING "___remote_users"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ALTER COLUMN "___local_users" TYPE integer USING "___local_users"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ALTER COLUMN "___remote_users" TYPE integer USING "___remote_users"::integer`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async down(queryRunner) {
|
||||||
|
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__active_users" ALTER COLUMN "___local_users" TYPE bigint USING "___local_users"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__active_users" ALTER COLUMN "___remote_users" TYPE bigint USING "___remote_users"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ALTER COLUMN "___local_users" TYPE bigint USING "___local_users"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ALTER COLUMN "___remote_users" TYPE bigint USING "___remote_users"::bigint`);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
const { MigrationInterface, QueryRunner } = require("typeorm");
|
||||||
|
|
||||||
|
module.exports = class chartV91644060125705 {
|
||||||
|
name = 'chartV91644060125705'
|
||||||
|
|
||||||
|
async up(queryRunner) {
|
||||||
|
await queryRunner.query(`UPDATE "__chart__hashtag" SET "___local_users"=2147483647 WHERE "___local_users" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart__hashtag" SET "___remote_users"=2147483647 WHERE "___remote_users" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__hashtag" SET "___local_users"=2147483647 WHERE "___local_users" > 2147483647`);
|
||||||
|
await queryRunner.query(`UPDATE "__chart_day__hashtag" SET "___remote_users"=2147483647 WHERE "___remote_users" > 2147483647`);
|
||||||
|
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__hashtag" ALTER COLUMN "___local_users" TYPE integer USING "___local_users"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__hashtag" ALTER COLUMN "___remote_users" TYPE integer USING "___remote_users"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__hashtag" ALTER COLUMN "___local_users" TYPE integer USING "___local_users"::integer`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__hashtag" ALTER COLUMN "___remote_users" TYPE integer USING "___remote_users"::integer`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async down(queryRunner) {
|
||||||
|
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__hashtag" ALTER COLUMN "___local_users" TYPE bigint USING "___local_users"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__hashtag" ALTER COLUMN "___remote_users" TYPE bigint USING "___remote_users"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__hashtag" ALTER COLUMN "___local_users" TYPE bigint USING "___local_users"::bigint`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__hashtag" ALTER COLUMN "___remote_users" TYPE bigint USING "___remote_users"::bigint`);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
const { MigrationInterface, QueryRunner } = require("typeorm");
|
||||||
|
|
||||||
|
module.exports = class chartV101644073149413 {
|
||||||
|
name = 'chartV101644073149413'
|
||||||
|
|
||||||
|
async up(queryRunner) {
|
||||||
|
await queryRunner.query(`CREATE TABLE "__chart__ap_request" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "___deliverFailed" integer NOT NULL DEFAULT '0', "___deliverSucceeded" integer NOT NULL DEFAULT '0', "___inboxReceived" integer NOT NULL DEFAULT '0', CONSTRAINT "UQ_e56f4beac5746d44bc3e19c80d0" UNIQUE ("date"), CONSTRAINT "PK_56a25cd447c7ee08876b3baf8d8" PRIMARY KEY ("id"))`);
|
||||||
|
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_e56f4beac5746d44bc3e19c80d" ON "__chart__ap_request" ("date") `);
|
||||||
|
await queryRunner.query(`CREATE TABLE "__chart_day__ap_request" ("id" SERIAL NOT NULL, "date" integer NOT NULL, "___deliverFailed" integer NOT NULL DEFAULT '0', "___deliverSucceeded" integer NOT NULL DEFAULT '0', "___inboxReceived" integer NOT NULL DEFAULT '0', CONSTRAINT "UQ_a848f66d6cec11980a5dd595822" UNIQUE ("date"), CONSTRAINT "PK_9318b49daee320194e23f712e69" PRIMARY KEY ("id"))`);
|
||||||
|
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_a848f66d6cec11980a5dd59582" ON "__chart_day__ap_request" ("date") `);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__federation" ADD "unique_temp___deliveredInstances" character varying array NOT NULL DEFAULT '{}'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__federation" ADD "___deliveredInstances" smallint NOT NULL DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__federation" ADD "unique_temp___inboxInstances" character varying array NOT NULL DEFAULT '{}'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__federation" ADD "___inboxInstances" smallint NOT NULL DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__federation" ADD "unique_temp___deliveredInstances" character varying array NOT NULL DEFAULT '{}'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__federation" ADD "___deliveredInstances" smallint NOT NULL DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__federation" ADD "unique_temp___inboxInstances" character varying array NOT NULL DEFAULT '{}'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__federation" ADD "___inboxInstances" smallint NOT NULL DEFAULT '0'`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async down(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__federation" DROP COLUMN "___inboxInstances"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__federation" DROP COLUMN "unique_temp___inboxInstances"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__federation" DROP COLUMN "___deliveredInstances"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart_day__federation" DROP COLUMN "unique_temp___deliveredInstances"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__federation" DROP COLUMN "___inboxInstances"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__federation" DROP COLUMN "unique_temp___inboxInstances"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__federation" DROP COLUMN "___deliveredInstances"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "__chart__federation" DROP COLUMN "unique_temp___deliveredInstances"`);
|
||||||
|
await queryRunner.query(`DROP INDEX "public"."IDX_a848f66d6cec11980a5dd59582"`);
|
||||||
|
await queryRunner.query(`DROP TABLE "__chart_day__ap_request"`);
|
||||||
|
await queryRunner.query(`DROP INDEX "public"."IDX_e56f4beac5746d44bc3e19c80d"`);
|
||||||
|
await queryRunner.query(`DROP TABLE "__chart__ap_request"`);
|
||||||
|
}
|
||||||
|
}
|
|
@ -55,7 +55,6 @@
|
||||||
"@types/ratelimiter": "3.4.3",
|
"@types/ratelimiter": "3.4.3",
|
||||||
"@types/redis": "4.0.11",
|
"@types/redis": "4.0.11",
|
||||||
"@types/rename": "1.0.4",
|
"@types/rename": "1.0.4",
|
||||||
"@types/request-stats": "3.0.0",
|
|
||||||
"@types/sanitize-html": "2.6.2",
|
"@types/sanitize-html": "2.6.2",
|
||||||
"@types/seedrandom": "3.0.1",
|
"@types/seedrandom": "3.0.1",
|
||||||
"@types/sharp": "0.29.5",
|
"@types/sharp": "0.29.5",
|
||||||
|
@ -144,7 +143,6 @@
|
||||||
"redis-lock": "0.1.4",
|
"redis-lock": "0.1.4",
|
||||||
"reflect-metadata": "0.1.13",
|
"reflect-metadata": "0.1.13",
|
||||||
"rename": "1.0.4",
|
"rename": "1.0.4",
|
||||||
"request-stats": "3.0.0",
|
|
||||||
"require-all": "3.0.0",
|
"require-all": "3.0.0",
|
||||||
"rndstr": "1.0.0",
|
"rndstr": "1.0.0",
|
||||||
"s-age": "1.1.2",
|
"s-age": "1.1.2",
|
||||||
|
|
|
@ -261,6 +261,11 @@ export default function() {
|
||||||
}, {
|
}, {
|
||||||
repeat: { cron: '0 0 * * *' },
|
repeat: { cron: '0 0 * * *' },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
systemQueue.add('cleanCharts', {
|
||||||
|
}, {
|
||||||
|
repeat: { cron: '0 0 * * *' },
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function destroy() {
|
export function destroy() {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import request from '@/remote/activitypub/request';
|
||||||
import { registerOrFetchInstanceDoc } from '@/services/register-or-fetch-instance-doc';
|
import { registerOrFetchInstanceDoc } from '@/services/register-or-fetch-instance-doc';
|
||||||
import Logger from '@/services/logger';
|
import Logger from '@/services/logger';
|
||||||
import { Instances } from '@/models/index';
|
import { Instances } from '@/models/index';
|
||||||
import { instanceChart } from '@/services/chart/index';
|
import { apRequestChart, federationChart, instanceChart } from '@/services/chart/index';
|
||||||
import { fetchInstanceMetadata } from '@/services/fetch-instance-metadata';
|
import { fetchInstanceMetadata } from '@/services/fetch-instance-metadata';
|
||||||
import { fetchMeta } from '@/misc/fetch-meta';
|
import { fetchMeta } from '@/misc/fetch-meta';
|
||||||
import { toPuny } from '@/misc/convert-host';
|
import { toPuny } from '@/misc/convert-host';
|
||||||
|
@ -61,6 +61,8 @@ export default async (job: Bull.Job<DeliverJobData>) => {
|
||||||
fetchInstanceMetadata(i);
|
fetchInstanceMetadata(i);
|
||||||
|
|
||||||
instanceChart.requestSent(i.host, true);
|
instanceChart.requestSent(i.host, true);
|
||||||
|
apRequestChart.deliverSucc();
|
||||||
|
federationChart.deliverd(i.host);
|
||||||
});
|
});
|
||||||
|
|
||||||
return 'Success';
|
return 'Success';
|
||||||
|
@ -74,6 +76,7 @@ export default async (job: Bull.Job<DeliverJobData>) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
instanceChart.requestSent(i.host, false);
|
instanceChart.requestSent(i.host, false);
|
||||||
|
apRequestChart.deliverFail();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res instanceof StatusError) {
|
if (res instanceof StatusError) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import perform from '@/remote/activitypub/perform';
|
||||||
import Logger from '@/services/logger';
|
import Logger from '@/services/logger';
|
||||||
import { registerOrFetchInstanceDoc } from '@/services/register-or-fetch-instance-doc';
|
import { registerOrFetchInstanceDoc } from '@/services/register-or-fetch-instance-doc';
|
||||||
import { Instances } from '@/models/index';
|
import { Instances } from '@/models/index';
|
||||||
import { instanceChart } from '@/services/chart/index';
|
import { apRequestChart, federationChart, instanceChart } from '@/services/chart/index';
|
||||||
import { fetchMeta } from '@/misc/fetch-meta';
|
import { fetchMeta } from '@/misc/fetch-meta';
|
||||||
import { toPuny, extractDbHost } from '@/misc/convert-host';
|
import { toPuny, extractDbHost } from '@/misc/convert-host';
|
||||||
import { getApId } from '@/remote/activitypub/type';
|
import { getApId } from '@/remote/activitypub/type';
|
||||||
|
@ -143,6 +143,8 @@ export default async (job: Bull.Job<InboxJobData>): Promise<string> => {
|
||||||
fetchInstanceMetadata(i);
|
fetchInstanceMetadata(i);
|
||||||
|
|
||||||
instanceChart.requestReceived(i.host);
|
instanceChart.requestReceived(i.host);
|
||||||
|
apRequestChart.inbox();
|
||||||
|
federationChart.inbox(i.host);
|
||||||
});
|
});
|
||||||
|
|
||||||
// アクティビティを処理
|
// アクティビティを処理
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
import * as Bull from 'bull';
|
||||||
|
|
||||||
|
import { queueLogger } from '../../logger';
|
||||||
|
import { activeUsersChart, driveChart, federationChart, hashtagChart, instanceChart, notesChart, perUserDriveChart, perUserFollowingChart, perUserNotesChart, perUserReactionsChart, usersChart, apRequestChart } from '@/services/chart/index';
|
||||||
|
|
||||||
|
const logger = queueLogger.createSubLogger('clean-charts');
|
||||||
|
|
||||||
|
export async function cleanCharts(job: Bull.Job<Record<string, unknown>>, done: any): Promise<void> {
|
||||||
|
logger.info(`Resync charts...`);
|
||||||
|
|
||||||
|
await Promise.all([
|
||||||
|
federationChart.clean(),
|
||||||
|
notesChart.clean(),
|
||||||
|
usersChart.clean(),
|
||||||
|
activeUsersChart.clean(),
|
||||||
|
instanceChart.clean(),
|
||||||
|
perUserNotesChart.clean(),
|
||||||
|
driveChart.clean(),
|
||||||
|
perUserReactionsChart.clean(),
|
||||||
|
hashtagChart.clean(),
|
||||||
|
perUserFollowingChart.clean(),
|
||||||
|
perUserDriveChart.clean(),
|
||||||
|
apRequestChart.clean(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
logger.succ(`All charts successfully cleaned.`);
|
||||||
|
done();
|
||||||
|
}
|
|
@ -1,8 +1,10 @@
|
||||||
import * as Bull from 'bull';
|
import * as Bull from 'bull';
|
||||||
import { resyncCharts } from './resync-charts';
|
import { resyncCharts } from './resync-charts';
|
||||||
|
import { cleanCharts } from './clean-charts';
|
||||||
|
|
||||||
const jobs = {
|
const jobs = {
|
||||||
resyncCharts,
|
resyncCharts,
|
||||||
|
cleanCharts,
|
||||||
} as Record<string, Bull.ProcessCallbackFunction<Record<string, unknown>> | Bull.ProcessPromiseFunction<Record<string, unknown>>>;
|
} as Record<string, Bull.ProcessCallbackFunction<Record<string, unknown>> | Bull.ProcessPromiseFunction<Record<string, unknown>>>;
|
||||||
|
|
||||||
export default function(dbQueue: Bull.Queue<Record<string, unknown>>) {
|
export default function(dbQueue: Bull.Queue<Record<string, unknown>>) {
|
||||||
|
|
|
@ -22,7 +22,7 @@ export const meta = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
res: convertLog(activeUsersChart.schema),
|
// TODO: response definition
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import $ from 'cafy';
|
import $ from 'cafy';
|
||||||
import define from '../../define';
|
import define from '../../define';
|
||||||
import { convertLog } from '@/services/chart/core';
|
import { convertLog } from '@/services/chart/core';
|
||||||
import { networkChart } from '@/services/chart/index';
|
import { apRequestChart } from '@/services/chart/index';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ['charts'],
|
tags: ['charts'],
|
||||||
|
@ -22,10 +22,10 @@ export const meta = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
res: convertLog(networkChart.schema),
|
// TODO: response definition
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
export default define(meta, async (ps) => {
|
export default define(meta, async (ps) => {
|
||||||
return await networkChart.getChart(ps.span as any, ps.limit!, ps.offset ? new Date(ps.offset) : null);
|
return await apRequestChart.getChart(ps.span as any, ps.limit!, ps.offset ? new Date(ps.offset) : null);
|
||||||
});
|
});
|
|
@ -22,7 +22,7 @@ export const meta = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
res: convertLog(driveChart.schema),
|
// TODO: response definition
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
|
|
|
@ -22,7 +22,7 @@ export const meta = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
res: convertLog(federationChart.schema),
|
// TODO: response definition
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
|
|
|
@ -26,7 +26,7 @@ export const meta = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
res: convertLog(hashtagChart.schema),
|
// TODO: response definition
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
|
|
|
@ -26,7 +26,7 @@ export const meta = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
res: convertLog(instanceChart.schema),
|
// TODO: response definition
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
|
|
|
@ -22,7 +22,7 @@ export const meta = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
res: convertLog(notesChart.schema),
|
// TODO: response definition
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
|
|
|
@ -27,7 +27,7 @@ export const meta = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
res: convertLog(perUserDriveChart.schema),
|
// TODO: response definition
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
|
|
|
@ -27,7 +27,7 @@ export const meta = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
res: convertLog(perUserFollowingChart.schema),
|
// TODO: response definition
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
|
|
|
@ -27,7 +27,7 @@ export const meta = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
res: convertLog(perUserNotesChart.schema),
|
// TODO: response definition
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
|
|
|
@ -27,7 +27,7 @@ export const meta = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
res: convertLog(perUserReactionsChart.schema),
|
// TODO: response definition
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
|
|
|
@ -22,7 +22,7 @@ export const meta = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
res: convertLog(usersChart.schema),
|
// TODO: response definition
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
|
|
|
@ -66,8 +66,8 @@ export default define(meta, async () => {
|
||||||
NoteReactions.count({ cache: 3600000 }), // 1 hour
|
NoteReactions.count({ cache: 3600000 }), // 1 hour
|
||||||
//NoteReactions.count({ where: { userHost: null }, cache: 3600000 }),
|
//NoteReactions.count({ where: { userHost: null }, cache: 3600000 }),
|
||||||
federationChart.getChart('hour', 1, null).then(chart => chart.instance.total[0]),
|
federationChart.getChart('hour', 1, null).then(chart => chart.instance.total[0]),
|
||||||
driveChart.getChart('hour', 1, null).then(chart => chart.local.totalSize[0]),
|
driveChart.getChart('hour', 1, null).then(chart => chart.local.totalSize[0] * 1000),
|
||||||
driveChart.getChart('hour', 1, null).then(chart => chart.remote.totalSize[0]),
|
driveChart.getChart('hour', 1, null).then(chart => chart.remote.totalSize[0] * 1000),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -10,7 +10,6 @@ import * as Koa from 'koa';
|
||||||
import * as Router from '@koa/router';
|
import * as Router from '@koa/router';
|
||||||
import * as mount from 'koa-mount';
|
import * as mount from 'koa-mount';
|
||||||
import * as koaLogger from 'koa-logger';
|
import * as koaLogger from 'koa-logger';
|
||||||
import * as requestStats from 'request-stats';
|
|
||||||
import * as slow from 'koa-slow';
|
import * as slow from 'koa-slow';
|
||||||
|
|
||||||
import activityPub from './activitypub';
|
import activityPub from './activitypub';
|
||||||
|
@ -18,11 +17,9 @@ import nodeinfo from './nodeinfo';
|
||||||
import wellKnown from './well-known';
|
import wellKnown from './well-known';
|
||||||
import config from '@/config/index';
|
import config from '@/config/index';
|
||||||
import apiServer from './api/index';
|
import apiServer from './api/index';
|
||||||
import { sum } from '@/prelude/array';
|
|
||||||
import Logger from '@/services/logger';
|
import Logger from '@/services/logger';
|
||||||
import { envOption } from '../env';
|
import { envOption } from '../env';
|
||||||
import { UserProfiles, Users } from '@/models/index';
|
import { UserProfiles, Users } from '@/models/index';
|
||||||
import { networkChart } from '@/services/chart/index';
|
|
||||||
import { genIdenticon } from '@/misc/gen-identicon';
|
import { genIdenticon } from '@/misc/gen-identicon';
|
||||||
import { createTemp } from '@/misc/create-temp';
|
import { createTemp } from '@/misc/create-temp';
|
||||||
import { publishMainStream } from '@/services/stream';
|
import { publishMainStream } from '@/services/stream';
|
||||||
|
@ -153,27 +150,4 @@ export default () => new Promise(resolve => {
|
||||||
|
|
||||||
// Listen
|
// Listen
|
||||||
server.listen(config.port, resolve);
|
server.listen(config.port, resolve);
|
||||||
|
|
||||||
//#region Network stats
|
|
||||||
let queue: any[] = [];
|
|
||||||
|
|
||||||
requestStats(server, (stats: any) => {
|
|
||||||
if (stats.ok) {
|
|
||||||
queue.push(stats);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Bulk write
|
|
||||||
setInterval(() => {
|
|
||||||
if (queue.length === 0) return;
|
|
||||||
|
|
||||||
const requests = queue.length;
|
|
||||||
const time = sum(queue.map(x => x.time));
|
|
||||||
const incomingBytes = sum(queue.map(x => x.req.byets));
|
|
||||||
const outgoingBytes = sum(queue.map(x => x.res.byets));
|
|
||||||
queue = [];
|
|
||||||
|
|
||||||
networkChart.update(requests, time, incomingBytes, outgoingBytes);
|
|
||||||
}, 5000);
|
|
||||||
//#endregion
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,51 +1,28 @@
|
||||||
import autobind from 'autobind-decorator';
|
import autobind from 'autobind-decorator';
|
||||||
import Chart, { Obj, DeepPartial } from '../core';
|
import Chart, { KVs } from '../core';
|
||||||
import { User } from '@/models/entities/user';
|
import { User } from '@/models/entities/user';
|
||||||
import { SchemaType } from '@/misc/schema';
|
|
||||||
import { Users } from '@/models/index';
|
import { Users } from '@/models/index';
|
||||||
import { name, schema } from './entities/active-users';
|
import { name, schema } from './entities/active-users';
|
||||||
|
|
||||||
type ActiveUsersLog = SchemaType<typeof schema>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* アクティブユーザーに関するチャート
|
* アクティブユーザーに関するチャート
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
export default class ActiveUsersChart extends Chart<ActiveUsersLog> {
|
export default class ActiveUsersChart extends Chart<typeof schema> {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(name, schema);
|
super(name, schema);
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
protected genNewLog(latest: ActiveUsersLog): DeepPartial<ActiveUsersLog> {
|
protected async queryCurrentState(): Promise<Partial<KVs<typeof schema>>> {
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
protected aggregate(logs: ActiveUsersLog[]): ActiveUsersLog {
|
|
||||||
return {
|
|
||||||
local: {
|
|
||||||
users: logs.reduce((a, b) => a.concat(b.local.users), [] as ActiveUsersLog['local']['users']),
|
|
||||||
},
|
|
||||||
remote: {
|
|
||||||
users: logs.reduce((a, b) => a.concat(b.remote.users), [] as ActiveUsersLog['remote']['users']),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
protected async fetchActual(): Promise<DeepPartial<ActiveUsersLog>> {
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
public async update(user: { id: User['id'], host: User['host'] }): Promise<void> {
|
public async update(user: { id: User['id'], host: User['host'] }): Promise<void> {
|
||||||
const update: Obj = {
|
await this.commit({
|
||||||
users: [user.id],
|
'local.users': Users.isLocalUser(user) ? [user.id] : [],
|
||||||
};
|
'remote.users': Users.isLocalUser(user) ? [] : [user.id],
|
||||||
|
|
||||||
await this.inc({
|
|
||||||
[Users.isLocalUser(user) ? 'local' : 'remote']: update,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
import autobind from 'autobind-decorator';
|
||||||
|
import Chart, { KVs } from '../core';
|
||||||
|
import { name, schema } from './entities/ap-request';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chart about ActivityPub requests
|
||||||
|
*/
|
||||||
|
// eslint-disable-next-line import/no-default-export
|
||||||
|
export default class ApRequestChart extends Chart<typeof schema> {
|
||||||
|
constructor() {
|
||||||
|
super(name, schema);
|
||||||
|
}
|
||||||
|
|
||||||
|
@autobind
|
||||||
|
protected async queryCurrentState(): Promise<Partial<KVs<typeof schema>>> {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
@autobind
|
||||||
|
public async deliverSucc(): Promise<void> {
|
||||||
|
await this.commit({
|
||||||
|
'deliverSucceeded': 1,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@autobind
|
||||||
|
public async deliverFail(): Promise<void> {
|
||||||
|
await this.commit({
|
||||||
|
'deliverFailed': 1,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@autobind
|
||||||
|
public async inbox(): Promise<void> {
|
||||||
|
await this.commit({
|
||||||
|
'inboxReceived': 1,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,95 +1,37 @@
|
||||||
import autobind from 'autobind-decorator';
|
import autobind from 'autobind-decorator';
|
||||||
import Chart, { Obj, DeepPartial } from '../core';
|
import Chart, { KVs } from '../core';
|
||||||
import { SchemaType } from '@/misc/schema';
|
|
||||||
import { DriveFiles } from '@/models/index';
|
import { DriveFiles } from '@/models/index';
|
||||||
import { Not, IsNull } from 'typeorm';
|
import { Not, IsNull } from 'typeorm';
|
||||||
import { DriveFile } from '@/models/entities/drive-file';
|
import { DriveFile } from '@/models/entities/drive-file';
|
||||||
import { name, schema } from './entities/drive';
|
import { name, schema } from './entities/drive';
|
||||||
|
|
||||||
type DriveLog = SchemaType<typeof schema>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ドライブに関するチャート
|
* ドライブに関するチャート
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
export default class DriveChart extends Chart<DriveLog> {
|
export default class DriveChart extends Chart<typeof schema> {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(name, schema);
|
super(name, schema);
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
protected genNewLog(latest: DriveLog): DeepPartial<DriveLog> {
|
protected async queryCurrentState(): Promise<Partial<KVs<typeof schema>>> {
|
||||||
return {
|
return {};
|
||||||
local: {
|
|
||||||
totalCount: latest.local.totalCount,
|
|
||||||
totalSize: latest.local.totalSize,
|
|
||||||
},
|
|
||||||
remote: {
|
|
||||||
totalCount: latest.remote.totalCount,
|
|
||||||
totalSize: latest.remote.totalSize,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
protected aggregate(logs: DriveLog[]): DriveLog {
|
|
||||||
return {
|
|
||||||
local: {
|
|
||||||
totalCount: logs[0].local.totalCount,
|
|
||||||
totalSize: logs[0].local.totalSize,
|
|
||||||
incCount: logs.reduce((a, b) => a + b.local.incCount, 0),
|
|
||||||
incSize: logs.reduce((a, b) => a + b.local.incSize, 0),
|
|
||||||
decCount: logs.reduce((a, b) => a + b.local.decCount, 0),
|
|
||||||
decSize: logs.reduce((a, b) => a + b.local.decSize, 0),
|
|
||||||
},
|
|
||||||
remote: {
|
|
||||||
totalCount: logs[0].remote.totalCount,
|
|
||||||
totalSize: logs[0].remote.totalSize,
|
|
||||||
incCount: logs.reduce((a, b) => a + b.remote.incCount, 0),
|
|
||||||
incSize: logs.reduce((a, b) => a + b.remote.incSize, 0),
|
|
||||||
decCount: logs.reduce((a, b) => a + b.remote.decCount, 0),
|
|
||||||
decSize: logs.reduce((a, b) => a + b.remote.decSize, 0),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
protected async fetchActual(): Promise<DeepPartial<DriveLog>> {
|
|
||||||
const [localCount, remoteCount, localSize, remoteSize] = await Promise.all([
|
|
||||||
DriveFiles.count({ userHost: null }),
|
|
||||||
DriveFiles.count({ userHost: Not(IsNull()) }),
|
|
||||||
DriveFiles.calcDriveUsageOfLocal(),
|
|
||||||
DriveFiles.calcDriveUsageOfRemote(),
|
|
||||||
]);
|
|
||||||
|
|
||||||
return {
|
|
||||||
local: {
|
|
||||||
totalCount: localCount,
|
|
||||||
totalSize: localSize,
|
|
||||||
},
|
|
||||||
remote: {
|
|
||||||
totalCount: remoteCount,
|
|
||||||
totalSize: remoteSize,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
public async update(file: DriveFile, isAdditional: boolean): Promise<void> {
|
public async update(file: DriveFile, isAdditional: boolean): Promise<void> {
|
||||||
const update: Obj = {};
|
const fileSizeKb = file.size / 1000;
|
||||||
|
await this.commit(file.userHost === null ? {
|
||||||
update.totalCount = isAdditional ? 1 : -1;
|
'local.incCount': isAdditional ? 1 : 0,
|
||||||
update.totalSize = isAdditional ? file.size : -file.size;
|
'local.incSize': isAdditional ? fileSizeKb : 0,
|
||||||
if (isAdditional) {
|
'local.decCount': isAdditional ? 0 : 1,
|
||||||
update.incCount = 1;
|
'local.decSize': isAdditional ? 0 : fileSizeKb,
|
||||||
update.incSize = file.size;
|
} : {
|
||||||
} else {
|
'remote.incCount': isAdditional ? 1 : 0,
|
||||||
update.decCount = 1;
|
'remote.incSize': isAdditional ? fileSizeKb : 0,
|
||||||
update.decSize = file.size;
|
'remote.decCount': isAdditional ? 0 : 1,
|
||||||
}
|
'remote.decSize': isAdditional ? 0 : fileSizeKb,
|
||||||
|
|
||||||
await this.inc({
|
|
||||||
[file.userHost === null ? 'local' : 'remote']: update,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,35 +2,9 @@ import Chart from '../../core';
|
||||||
|
|
||||||
export const name = 'activeUsers';
|
export const name = 'activeUsers';
|
||||||
|
|
||||||
const logSchema = {
|
|
||||||
/**
|
|
||||||
* アクティブユーザー
|
|
||||||
*/
|
|
||||||
users: {
|
|
||||||
type: 'array' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
items: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const schema = {
|
export const schema = {
|
||||||
type: 'object' as const,
|
'local.users': { uniqueIncrement: true },
|
||||||
optional: false as const, nullable: false as const,
|
'remote.users': { uniqueIncrement: true },
|
||||||
properties: {
|
} as const;
|
||||||
local: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: logSchema,
|
|
||||||
},
|
|
||||||
remote: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: logSchema,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const entity = Chart.schemaToEntity(name, schema);
|
export const entity = Chart.schemaToEntity(name, schema);
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
import Chart from '../../core';
|
||||||
|
|
||||||
|
export const name = 'apRequest';
|
||||||
|
|
||||||
|
export const schema = {
|
||||||
|
'deliverFailed': { },
|
||||||
|
'deliverSucceeded': { },
|
||||||
|
'inboxReceived': { },
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export const entity = Chart.schemaToEntity(name, schema);
|
|
@ -2,71 +2,15 @@ import Chart from '../../core';
|
||||||
|
|
||||||
export const name = 'drive';
|
export const name = 'drive';
|
||||||
|
|
||||||
const logSchema = {
|
|
||||||
/**
|
|
||||||
* 集計期間時点での、全ドライブファイル数
|
|
||||||
*/
|
|
||||||
totalCount: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 集計期間時点での、全ドライブファイルの合計サイズ
|
|
||||||
*/
|
|
||||||
totalSize: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 増加したドライブファイル数
|
|
||||||
*/
|
|
||||||
incCount: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 増加したドライブ使用量
|
|
||||||
*/
|
|
||||||
incSize: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 減少したドライブファイル数
|
|
||||||
*/
|
|
||||||
decCount: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 減少したドライブ使用量
|
|
||||||
*/
|
|
||||||
decSize: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const schema = {
|
export const schema = {
|
||||||
type: 'object' as const,
|
'local.incCount': {},
|
||||||
optional: false as const, nullable: false as const,
|
'local.incSize': {}, // in kilobyte
|
||||||
properties: {
|
'local.decCount': {},
|
||||||
local: {
|
'local.decSize': {}, // in kilobyte
|
||||||
type: 'object' as const,
|
'remote.incCount': {},
|
||||||
optional: false as const, nullable: false as const,
|
'remote.incSize': {}, // in kilobyte
|
||||||
properties: logSchema,
|
'remote.decCount': {},
|
||||||
},
|
'remote.decSize': {}, // in kilobyte
|
||||||
remote: {
|
} as const;
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: logSchema,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const entity = Chart.schemaToEntity(name, schema);
|
export const entity = Chart.schemaToEntity(name, schema);
|
||||||
|
|
|
@ -3,28 +3,11 @@ import Chart from '../../core';
|
||||||
export const name = 'federation';
|
export const name = 'federation';
|
||||||
|
|
||||||
export const schema = {
|
export const schema = {
|
||||||
type: 'object' as const,
|
'instance.total': { accumulate: true },
|
||||||
optional: false as const, nullable: false as const,
|
'instance.inc': { range: 'small' },
|
||||||
properties: {
|
'instance.dec': { range: 'small' },
|
||||||
instance: {
|
'deliveredInstances': { uniqueIncrement: true, range: 'small' },
|
||||||
type: 'object' as const,
|
'inboxInstances': { uniqueIncrement: true, range: 'small' },
|
||||||
optional: false as const, nullable: false as const,
|
} as const;
|
||||||
properties: {
|
|
||||||
total: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
inc: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
dec: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const entity = Chart.schemaToEntity(name, schema);
|
export const entity = Chart.schemaToEntity(name, schema);
|
||||||
|
|
|
@ -2,35 +2,9 @@ import Chart from '../../core';
|
||||||
|
|
||||||
export const name = 'hashtag';
|
export const name = 'hashtag';
|
||||||
|
|
||||||
const logSchema = {
|
|
||||||
/**
|
|
||||||
* 投稿したユーザー
|
|
||||||
*/
|
|
||||||
users: {
|
|
||||||
type: 'array' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
items: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const schema = {
|
export const schema = {
|
||||||
type: 'object' as const,
|
'local.users': { uniqueIncrement: true },
|
||||||
optional: false as const, nullable: false as const,
|
'remote.users': { uniqueIncrement: true },
|
||||||
properties: {
|
} as const;
|
||||||
local: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: logSchema,
|
|
||||||
},
|
|
||||||
remote: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: logSchema,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const entity = Chart.schemaToEntity(name, schema, true);
|
export const entity = Chart.schemaToEntity(name, schema, true);
|
||||||
|
|
|
@ -3,156 +3,29 @@ import Chart from '../../core';
|
||||||
export const name = 'instance';
|
export const name = 'instance';
|
||||||
|
|
||||||
export const schema = {
|
export const schema = {
|
||||||
type: 'object' as const,
|
'requests.failed': { range: 'small' },
|
||||||
optional: false as const, nullable: false as const,
|
'requests.succeeded': { range: 'small' },
|
||||||
properties: {
|
'requests.received': { range: 'small' },
|
||||||
requests: {
|
'notes.total': { accumulate: true },
|
||||||
type: 'object' as const,
|
'notes.inc': {},
|
||||||
optional: false as const, nullable: false as const,
|
'notes.dec': {},
|
||||||
properties: {
|
'notes.diffs.normal': {},
|
||||||
failed: {
|
'notes.diffs.reply': {},
|
||||||
type: 'number' as const,
|
'notes.diffs.renote': {},
|
||||||
optional: false as const, nullable: false as const,
|
'users.total': { accumulate: true },
|
||||||
},
|
'users.inc': { range: 'small' },
|
||||||
succeeded: {
|
'users.dec': { range: 'small' },
|
||||||
type: 'number' as const,
|
'following.total': { accumulate: true },
|
||||||
optional: false as const, nullable: false as const,
|
'following.inc': { range: 'small' },
|
||||||
},
|
'following.dec': { range: 'small' },
|
||||||
received: {
|
'followers.total': { accumulate: true },
|
||||||
type: 'number' as const,
|
'followers.inc': { range: 'small' },
|
||||||
optional: false as const, nullable: false as const,
|
'followers.dec': { range: 'small' },
|
||||||
},
|
'drive.totalFiles': { accumulate: true },
|
||||||
},
|
'drive.incFiles': {},
|
||||||
},
|
'drive.decFiles': {},
|
||||||
|
'drive.incUsage': {}, // in kilobyte
|
||||||
notes: {
|
'drive.decUsage': {}, // in kilobyte
|
||||||
type: 'object' as const,
|
} as const;
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
total: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
inc: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
dec: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
diffs: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
normal: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
reply: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
renote: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
users: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
total: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
inc: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
dec: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
following: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
total: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
inc: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
dec: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
followers: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
total: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
inc: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
dec: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
drive: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
totalFiles: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
totalUsage: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
incFiles: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
incUsage: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
decFiles: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
decUsage: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const entity = Chart.schemaToEntity(name, schema, true);
|
export const entity = Chart.schemaToEntity(name, schema, true);
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
import Chart from '../../core';
|
|
||||||
|
|
||||||
export const name = 'network';
|
|
||||||
|
|
||||||
export const schema = {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
incomingRequests: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
outgoingRequests: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
totalTime: { // TIP: (totalTime / incomingRequests) でひとつのリクエストに平均でどれくらいの時間がかかったか知れる
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
incomingBytes: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
outgoingBytes: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const entity = Chart.schemaToEntity(name, schema);
|
|
|
@ -2,59 +2,19 @@ import Chart from '../../core';
|
||||||
|
|
||||||
export const name = 'notes';
|
export const name = 'notes';
|
||||||
|
|
||||||
const logSchema = {
|
|
||||||
total: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
inc: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
dec: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
diffs: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
normal: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
reply: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
renote: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const schema = {
|
export const schema = {
|
||||||
type: 'object' as const,
|
'local.total': { accumulate: true },
|
||||||
optional: false as const, nullable: false as const,
|
'local.inc': {},
|
||||||
properties: {
|
'local.dec': {},
|
||||||
local: {
|
'local.diffs.normal': {},
|
||||||
type: 'object' as const,
|
'local.diffs.reply': {},
|
||||||
optional: false as const, nullable: false as const,
|
'local.diffs.renote': {},
|
||||||
properties: logSchema,
|
'remote.total': { accumulate: true },
|
||||||
},
|
'remote.inc': {},
|
||||||
remote: {
|
'remote.dec': {},
|
||||||
type: 'object' as const,
|
'remote.diffs.normal': {},
|
||||||
optional: false as const, nullable: false as const,
|
'remote.diffs.reply': {},
|
||||||
properties: logSchema,
|
'remote.diffs.renote': {},
|
||||||
},
|
} as const;
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const entity = Chart.schemaToEntity(name, schema);
|
export const entity = Chart.schemaToEntity(name, schema);
|
||||||
|
|
|
@ -3,57 +3,12 @@ import Chart from '../../core';
|
||||||
export const name = 'perUserDrive';
|
export const name = 'perUserDrive';
|
||||||
|
|
||||||
export const schema = {
|
export const schema = {
|
||||||
type: 'object' as const,
|
'totalCount': { accumulate: true },
|
||||||
optional: false as const, nullable: false as const,
|
'totalSize': { accumulate: true }, // in kilobyte
|
||||||
properties: {
|
'incCount': { range: 'small' },
|
||||||
/**
|
'incSize': {}, // in kilobyte
|
||||||
* 集計期間時点での、全ドライブファイル数
|
'decCount': { range: 'small' },
|
||||||
*/
|
'decSize': {}, // in kilobyte
|
||||||
totalCount: {
|
} as const;
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 集計期間時点での、全ドライブファイルの合計サイズ
|
|
||||||
*/
|
|
||||||
totalSize: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 増加したドライブファイル数
|
|
||||||
*/
|
|
||||||
incCount: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 増加したドライブ使用量
|
|
||||||
*/
|
|
||||||
incSize: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 減少したドライブファイル数
|
|
||||||
*/
|
|
||||||
decCount: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 減少したドライブ使用量
|
|
||||||
*/
|
|
||||||
decSize: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const entity = Chart.schemaToEntity(name, schema, true);
|
export const entity = Chart.schemaToEntity(name, schema, true);
|
||||||
|
|
|
@ -2,89 +2,19 @@ import Chart from '../../core';
|
||||||
|
|
||||||
export const name = 'perUserFollowing';
|
export const name = 'perUserFollowing';
|
||||||
|
|
||||||
const logSchema = {
|
|
||||||
/**
|
|
||||||
* フォローしている
|
|
||||||
*/
|
|
||||||
followings: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
/**
|
|
||||||
* フォローしている合計
|
|
||||||
*/
|
|
||||||
total: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* フォローした数
|
|
||||||
*/
|
|
||||||
inc: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* フォロー解除した数
|
|
||||||
*/
|
|
||||||
dec: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* フォローされている
|
|
||||||
*/
|
|
||||||
followers: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
/**
|
|
||||||
* フォローされている合計
|
|
||||||
*/
|
|
||||||
total: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* フォローされた数
|
|
||||||
*/
|
|
||||||
inc: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* フォロー解除された数
|
|
||||||
*/
|
|
||||||
dec: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const schema = {
|
export const schema = {
|
||||||
type: 'object' as const,
|
'local.followings.total': { accumulate: true },
|
||||||
optional: false as const, nullable: false as const,
|
'local.followings.inc': { range: 'small' },
|
||||||
properties: {
|
'local.followings.dec': { range: 'small' },
|
||||||
local: {
|
'local.followers.total': { accumulate: true },
|
||||||
type: 'object' as const,
|
'local.followers.inc': { range: 'small' },
|
||||||
optional: false as const, nullable: false as const,
|
'local.followers.dec': { range: 'small' },
|
||||||
properties: logSchema,
|
'remote.followings.total': { accumulate: true },
|
||||||
},
|
'remote.followings.inc': { range: 'small' },
|
||||||
remote: {
|
'remote.followings.dec': { range: 'small' },
|
||||||
type: 'object' as const,
|
'remote.followers.total': { accumulate: true },
|
||||||
optional: false as const, nullable: false as const,
|
'remote.followers.inc': { range: 'small' },
|
||||||
properties: logSchema,
|
'remote.followers.dec': { range: 'small' },
|
||||||
},
|
} as const;
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const entity = Chart.schemaToEntity(name, schema, true);
|
export const entity = Chart.schemaToEntity(name, schema, true);
|
||||||
|
|
|
@ -3,45 +3,12 @@ import Chart from '../../core';
|
||||||
export const name = 'perUserNotes';
|
export const name = 'perUserNotes';
|
||||||
|
|
||||||
export const schema = {
|
export const schema = {
|
||||||
type: 'object' as const,
|
'total': { accumulate: true },
|
||||||
optional: false as const, nullable: false as const,
|
'inc': { range: 'small' },
|
||||||
properties: {
|
'dec': { range: 'small' },
|
||||||
total: {
|
'diffs.normal': { range: 'small' },
|
||||||
type: 'number' as const,
|
'diffs.reply': { range: 'small' },
|
||||||
optional: false as const, nullable: false as const,
|
'diffs.renote': { range: 'small' },
|
||||||
},
|
} as const;
|
||||||
|
|
||||||
inc: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
dec: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
diffs: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
normal: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
reply: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
renote: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const entity = Chart.schemaToEntity(name, schema, true);
|
export const entity = Chart.schemaToEntity(name, schema, true);
|
||||||
|
|
|
@ -2,31 +2,9 @@ import Chart from '../../core';
|
||||||
|
|
||||||
export const name = 'perUserReaction';
|
export const name = 'perUserReaction';
|
||||||
|
|
||||||
const logSchema = {
|
|
||||||
/**
|
|
||||||
* 被リアクション数
|
|
||||||
*/
|
|
||||||
count: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const schema = {
|
export const schema = {
|
||||||
type: 'object' as const,
|
'local.count': { range: 'small' },
|
||||||
optional: false as const, nullable: false as const,
|
'remote.count': { range: 'small' },
|
||||||
properties: {
|
} as const;
|
||||||
local: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: logSchema,
|
|
||||||
},
|
|
||||||
remote: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: logSchema,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const entity = Chart.schemaToEntity(name, schema, true);
|
export const entity = Chart.schemaToEntity(name, schema, true);
|
||||||
|
|
|
@ -3,30 +3,9 @@ import Chart from '../../core';
|
||||||
export const name = 'testGrouped';
|
export const name = 'testGrouped';
|
||||||
|
|
||||||
export const schema = {
|
export const schema = {
|
||||||
type: 'object' as const,
|
'foo.total': { accumulate: true },
|
||||||
optional: false as const, nullable: false as const,
|
'foo.inc': {},
|
||||||
properties: {
|
'foo.dec': {},
|
||||||
foo: {
|
} as const;
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
total: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
inc: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
dec: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const entity = Chart.schemaToEntity(name, schema, true);
|
export const entity = Chart.schemaToEntity(name, schema, true);
|
||||||
|
|
|
@ -3,18 +3,7 @@ import Chart from '../../core';
|
||||||
export const name = 'testUnique';
|
export const name = 'testUnique';
|
||||||
|
|
||||||
export const schema = {
|
export const schema = {
|
||||||
type: 'object' as const,
|
'foo': { uniqueIncrement: true },
|
||||||
optional: false as const, nullable: false as const,
|
} as const;
|
||||||
properties: {
|
|
||||||
foo: {
|
|
||||||
type: 'array' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
items: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const entity = Chart.schemaToEntity(name, schema);
|
export const entity = Chart.schemaToEntity(name, schema);
|
||||||
|
|
|
@ -3,30 +3,9 @@ import Chart from '../../core';
|
||||||
export const name = 'test';
|
export const name = 'test';
|
||||||
|
|
||||||
export const schema = {
|
export const schema = {
|
||||||
type: 'object' as const,
|
'foo.total': { accumulate: true },
|
||||||
optional: false as const, nullable: false as const,
|
'foo.inc': {},
|
||||||
properties: {
|
'foo.dec': {},
|
||||||
foo: {
|
} as const;
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
total: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
inc: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
dec: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const entity = Chart.schemaToEntity(name, schema);
|
export const entity = Chart.schemaToEntity(name, schema);
|
||||||
|
|
|
@ -2,47 +2,13 @@ import Chart from '../../core';
|
||||||
|
|
||||||
export const name = 'users';
|
export const name = 'users';
|
||||||
|
|
||||||
const logSchema = {
|
|
||||||
/**
|
|
||||||
* 集計期間時点での、全ユーザー数
|
|
||||||
*/
|
|
||||||
total: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 増加したユーザー数
|
|
||||||
*/
|
|
||||||
inc: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 減少したユーザー数
|
|
||||||
*/
|
|
||||||
dec: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const schema = {
|
export const schema = {
|
||||||
type: 'object' as const,
|
'local.total': { accumulate: true },
|
||||||
optional: false as const, nullable: false as const,
|
'local.inc': { range: 'small' },
|
||||||
properties: {
|
'local.dec': { range: 'small' },
|
||||||
local: {
|
'remote.total': { accumulate: true },
|
||||||
type: 'object' as const,
|
'remote.inc': { range: 'small' },
|
||||||
optional: false as const, nullable: false as const,
|
'remote.dec': { range: 'small' },
|
||||||
properties: logSchema,
|
} as const;
|
||||||
},
|
|
||||||
remote: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: logSchema,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const entity = Chart.schemaToEntity(name, schema);
|
export const entity = Chart.schemaToEntity(name, schema);
|
||||||
|
|
|
@ -1,66 +1,48 @@
|
||||||
import autobind from 'autobind-decorator';
|
import autobind from 'autobind-decorator';
|
||||||
import Chart, { Obj, DeepPartial } from '../core';
|
import Chart, { KVs } from '../core';
|
||||||
import { SchemaType } from '@/misc/schema';
|
|
||||||
import { Instances } from '@/models/index';
|
import { Instances } from '@/models/index';
|
||||||
import { name, schema } from './entities/federation';
|
import { name, schema } from './entities/federation';
|
||||||
|
|
||||||
type FederationLog = SchemaType<typeof schema>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* フェデレーションに関するチャート
|
* フェデレーションに関するチャート
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
export default class FederationChart extends Chart<FederationLog> {
|
export default class FederationChart extends Chart<typeof schema> {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(name, schema);
|
super(name, schema);
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
protected genNewLog(latest: FederationLog): DeepPartial<FederationLog> {
|
protected async queryCurrentState(): Promise<Partial<KVs<typeof schema>>> {
|
||||||
return {
|
|
||||||
instance: {
|
|
||||||
total: latest.instance.total,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
protected aggregate(logs: FederationLog[]): FederationLog {
|
|
||||||
return {
|
|
||||||
instance: {
|
|
||||||
total: logs[0].instance.total,
|
|
||||||
inc: logs.reduce((a, b) => a + b.instance.inc, 0),
|
|
||||||
dec: logs.reduce((a, b) => a + b.instance.dec, 0),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
protected async fetchActual(): Promise<DeepPartial<FederationLog>> {
|
|
||||||
const [total] = await Promise.all([
|
const [total] = await Promise.all([
|
||||||
Instances.count({}),
|
Instances.count({}),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
instance: {
|
'instance.total': total,
|
||||||
total: total,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
public async update(isAdditional: boolean): Promise<void> {
|
public async update(isAdditional: boolean): Promise<void> {
|
||||||
const update: Obj = {};
|
await this.commit({
|
||||||
|
'instance.total': isAdditional ? 1 : -1,
|
||||||
|
'instance.inc': isAdditional ? 1 : 0,
|
||||||
|
'instance.dec': isAdditional ? 0 : 1,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
update.total = isAdditional ? 1 : -1;
|
@autobind
|
||||||
if (isAdditional) {
|
public async deliverd(host: string): Promise<void> {
|
||||||
update.inc = 1;
|
await this.commit({
|
||||||
} else {
|
'deliveredInstances': [host],
|
||||||
update.dec = 1;
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.inc({
|
@autobind
|
||||||
instance: update,
|
public async inbox(host: string): Promise<void> {
|
||||||
|
await this.commit({
|
||||||
|
'inboxInstances': [host],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,51 +1,28 @@
|
||||||
import autobind from 'autobind-decorator';
|
import autobind from 'autobind-decorator';
|
||||||
import Chart, { Obj, DeepPartial } from '../core';
|
import Chart, { KVs } from '../core';
|
||||||
import { User } from '@/models/entities/user';
|
import { User } from '@/models/entities/user';
|
||||||
import { SchemaType } from '@/misc/schema';
|
|
||||||
import { Users } from '@/models/index';
|
import { Users } from '@/models/index';
|
||||||
import { name, schema } from './entities/hashtag';
|
import { name, schema } from './entities/hashtag';
|
||||||
|
|
||||||
type HashtagLog = SchemaType<typeof schema>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ハッシュタグに関するチャート
|
* ハッシュタグに関するチャート
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
export default class HashtagChart extends Chart<HashtagLog> {
|
export default class HashtagChart extends Chart<typeof schema> {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(name, schema, true);
|
super(name, schema, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
protected genNewLog(latest: HashtagLog): DeepPartial<HashtagLog> {
|
protected async queryCurrentState(): Promise<Partial<KVs<typeof schema>>> {
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
protected aggregate(logs: HashtagLog[]): HashtagLog {
|
|
||||||
return {
|
|
||||||
local: {
|
|
||||||
users: logs.reduce((a, b) => a.concat(b.local.users), [] as HashtagLog['local']['users']),
|
|
||||||
},
|
|
||||||
remote: {
|
|
||||||
users: logs.reduce((a, b) => a.concat(b.remote.users), [] as HashtagLog['remote']['users']),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
protected async fetchActual(): Promise<DeepPartial<HashtagLog>> {
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
public async update(hashtag: string, user: { id: User['id'], host: User['host'] }): Promise<void> {
|
public async update(hashtag: string, user: { id: User['id'], host: User['host'] }): Promise<void> {
|
||||||
const update: Obj = {
|
await this.commit({
|
||||||
users: [user.id],
|
'local.users': Users.isLocalUser(user) ? [user.id] : [],
|
||||||
};
|
'remote.users': Users.isLocalUser(user) ? [] : [user.id],
|
||||||
|
|
||||||
await this.inc({
|
|
||||||
[Users.isLocalUser(user) ? 'local' : 'remote']: update,
|
|
||||||
}, hashtag);
|
}, hashtag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,158 +1,67 @@
|
||||||
import autobind from 'autobind-decorator';
|
import autobind from 'autobind-decorator';
|
||||||
import Chart, { Obj, DeepPartial } from '../core';
|
import Chart, { KVs } from '../core';
|
||||||
import { SchemaType } from '@/misc/schema';
|
|
||||||
import { DriveFiles, Followings, Users, Notes } from '@/models/index';
|
import { DriveFiles, Followings, Users, Notes } from '@/models/index';
|
||||||
import { DriveFile } from '@/models/entities/drive-file';
|
import { DriveFile } from '@/models/entities/drive-file';
|
||||||
import { Note } from '@/models/entities/note';
|
import { Note } from '@/models/entities/note';
|
||||||
import { toPuny } from '@/misc/convert-host';
|
import { toPuny } from '@/misc/convert-host';
|
||||||
import { name, schema } from './entities/instance';
|
import { name, schema } from './entities/instance';
|
||||||
|
|
||||||
type InstanceLog = SchemaType<typeof schema>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* インスタンスごとのチャート
|
* インスタンスごとのチャート
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
export default class InstanceChart extends Chart<InstanceLog> {
|
export default class InstanceChart extends Chart<typeof schema> {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(name, schema, true);
|
super(name, schema, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
protected genNewLog(latest: InstanceLog): DeepPartial<InstanceLog> {
|
protected async queryCurrentState(group: string): Promise<Partial<KVs<typeof schema>>> {
|
||||||
return {
|
|
||||||
notes: {
|
|
||||||
total: latest.notes.total,
|
|
||||||
},
|
|
||||||
users: {
|
|
||||||
total: latest.users.total,
|
|
||||||
},
|
|
||||||
following: {
|
|
||||||
total: latest.following.total,
|
|
||||||
},
|
|
||||||
followers: {
|
|
||||||
total: latest.followers.total,
|
|
||||||
},
|
|
||||||
drive: {
|
|
||||||
totalFiles: latest.drive.totalFiles,
|
|
||||||
totalUsage: latest.drive.totalUsage,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
protected aggregate(logs: InstanceLog[]): InstanceLog {
|
|
||||||
return {
|
|
||||||
requests: {
|
|
||||||
failed: logs.reduce((a, b) => a + b.requests.failed, 0),
|
|
||||||
succeeded: logs.reduce((a, b) => a + b.requests.succeeded, 0),
|
|
||||||
received: logs.reduce((a, b) => a + b.requests.received, 0),
|
|
||||||
},
|
|
||||||
notes: {
|
|
||||||
total: logs[0].notes.total,
|
|
||||||
inc: logs.reduce((a, b) => a + b.notes.inc, 0),
|
|
||||||
dec: logs.reduce((a, b) => a + b.notes.dec, 0),
|
|
||||||
diffs: {
|
|
||||||
reply: logs.reduce((a, b) => a + b.notes.diffs.reply, 0),
|
|
||||||
renote: logs.reduce((a, b) => a + b.notes.diffs.renote, 0),
|
|
||||||
normal: logs.reduce((a, b) => a + b.notes.diffs.normal, 0),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
users: {
|
|
||||||
total: logs[0].users.total,
|
|
||||||
inc: logs.reduce((a, b) => a + b.users.inc, 0),
|
|
||||||
dec: logs.reduce((a, b) => a + b.users.dec, 0),
|
|
||||||
},
|
|
||||||
following: {
|
|
||||||
total: logs[0].following.total,
|
|
||||||
inc: logs.reduce((a, b) => a + b.following.inc, 0),
|
|
||||||
dec: logs.reduce((a, b) => a + b.following.dec, 0),
|
|
||||||
},
|
|
||||||
followers: {
|
|
||||||
total: logs[0].followers.total,
|
|
||||||
inc: logs.reduce((a, b) => a + b.followers.inc, 0),
|
|
||||||
dec: logs.reduce((a, b) => a + b.followers.dec, 0),
|
|
||||||
},
|
|
||||||
drive: {
|
|
||||||
totalFiles: logs[0].drive.totalFiles,
|
|
||||||
totalUsage: logs[0].drive.totalUsage,
|
|
||||||
incFiles: logs.reduce((a, b) => a + b.drive.incFiles, 0),
|
|
||||||
incUsage: logs.reduce((a, b) => a + b.drive.incUsage, 0),
|
|
||||||
decFiles: logs.reduce((a, b) => a + b.drive.decFiles, 0),
|
|
||||||
decUsage: logs.reduce((a, b) => a + b.drive.decUsage, 0),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
protected async fetchActual(group: string): Promise<DeepPartial<InstanceLog>> {
|
|
||||||
const [
|
const [
|
||||||
notesCount,
|
notesCount,
|
||||||
usersCount,
|
usersCount,
|
||||||
followingCount,
|
followingCount,
|
||||||
followersCount,
|
followersCount,
|
||||||
driveFiles,
|
driveFiles,
|
||||||
driveUsage,
|
//driveUsage,
|
||||||
] = await Promise.all([
|
] = await Promise.all([
|
||||||
Notes.count({ userHost: group }),
|
Notes.count({ userHost: group }),
|
||||||
Users.count({ host: group }),
|
Users.count({ host: group }),
|
||||||
Followings.count({ followerHost: group }),
|
Followings.count({ followerHost: group }),
|
||||||
Followings.count({ followeeHost: group }),
|
Followings.count({ followeeHost: group }),
|
||||||
DriveFiles.count({ userHost: group }),
|
DriveFiles.count({ userHost: group }),
|
||||||
DriveFiles.calcDriveUsageOfHost(group),
|
//DriveFiles.calcDriveUsageOfHost(group),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
notes: {
|
'notes.total': notesCount,
|
||||||
total: notesCount,
|
'users.total': usersCount,
|
||||||
},
|
'following.total': followingCount,
|
||||||
users: {
|
'followers.total': followersCount,
|
||||||
total: usersCount,
|
'drive.totalFiles': driveFiles,
|
||||||
},
|
|
||||||
following: {
|
|
||||||
total: followingCount,
|
|
||||||
},
|
|
||||||
followers: {
|
|
||||||
total: followersCount,
|
|
||||||
},
|
|
||||||
drive: {
|
|
||||||
totalFiles: driveFiles,
|
|
||||||
totalUsage: driveUsage,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
public async requestReceived(host: string): Promise<void> {
|
public async requestReceived(host: string): Promise<void> {
|
||||||
await this.inc({
|
await this.commit({
|
||||||
requests: {
|
'requests.received': 1,
|
||||||
received: 1,
|
|
||||||
},
|
|
||||||
}, toPuny(host));
|
}, toPuny(host));
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
public async requestSent(host: string, isSucceeded: boolean): Promise<void> {
|
public async requestSent(host: string, isSucceeded: boolean): Promise<void> {
|
||||||
const update: Obj = {};
|
await this.commit({
|
||||||
|
'requests.succeeded': isSucceeded ? 1 : 0,
|
||||||
if (isSucceeded) {
|
'requests.failed': isSucceeded ? 0 : 1,
|
||||||
update.succeeded = 1;
|
|
||||||
} else {
|
|
||||||
update.failed = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
await this.inc({
|
|
||||||
requests: update,
|
|
||||||
}, toPuny(host));
|
}, toPuny(host));
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
public async newUser(host: string): Promise<void> {
|
public async newUser(host: string): Promise<void> {
|
||||||
await this.inc({
|
await this.commit({
|
||||||
users: {
|
'users.total': 1,
|
||||||
total: 1,
|
'users.inc': 1,
|
||||||
inc: 1,
|
|
||||||
},
|
|
||||||
}, toPuny(host));
|
}, toPuny(host));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,54 +77,43 @@ export default class InstanceChart extends Chart<InstanceLog> {
|
||||||
diffs.normal = isAdditional ? 1 : -1;
|
diffs.normal = isAdditional ? 1 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.inc({
|
await this.commit({
|
||||||
notes: {
|
'notes.total': isAdditional ? 1 : -1,
|
||||||
total: isAdditional ? 1 : -1,
|
'notes.inc': isAdditional ? 1 : 0,
|
||||||
inc: isAdditional ? 1 : 0,
|
'notes.dec': isAdditional ? 0 : 1,
|
||||||
dec: isAdditional ? 0 : 1,
|
'notes.diffs.normal': note.replyId == null && note.renoteId == null ? (isAdditional ? 1 : -1) : 0,
|
||||||
diffs: diffs,
|
'notes.diffs.renote': note.renoteId != null ? (isAdditional ? 1 : -1) : 0,
|
||||||
},
|
'notes.diffs.reply': note.replyId != null ? (isAdditional ? 1 : -1) : 0,
|
||||||
}, toPuny(host));
|
}, toPuny(host));
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
public async updateFollowing(host: string, isAdditional: boolean): Promise<void> {
|
public async updateFollowing(host: string, isAdditional: boolean): Promise<void> {
|
||||||
await this.inc({
|
await this.commit({
|
||||||
following: {
|
'following.total': isAdditional ? 1 : -1,
|
||||||
total: isAdditional ? 1 : -1,
|
'following.inc': isAdditional ? 1 : 0,
|
||||||
inc: isAdditional ? 1 : 0,
|
'following.dec': isAdditional ? 0 : 1,
|
||||||
dec: isAdditional ? 0 : 1,
|
|
||||||
},
|
|
||||||
}, toPuny(host));
|
}, toPuny(host));
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
public async updateFollowers(host: string, isAdditional: boolean): Promise<void> {
|
public async updateFollowers(host: string, isAdditional: boolean): Promise<void> {
|
||||||
await this.inc({
|
await this.commit({
|
||||||
followers: {
|
'followers.total': isAdditional ? 1 : -1,
|
||||||
total: isAdditional ? 1 : -1,
|
'followers.inc': isAdditional ? 1 : 0,
|
||||||
inc: isAdditional ? 1 : 0,
|
'followers.dec': isAdditional ? 0 : 1,
|
||||||
dec: isAdditional ? 0 : 1,
|
|
||||||
},
|
|
||||||
}, toPuny(host));
|
}, toPuny(host));
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
public async updateDrive(file: DriveFile, isAdditional: boolean): Promise<void> {
|
public async updateDrive(file: DriveFile, isAdditional: boolean): Promise<void> {
|
||||||
const update: Obj = {};
|
const fileSizeKb = file.size / 1000;
|
||||||
|
await this.commit({
|
||||||
update.totalFiles = isAdditional ? 1 : -1;
|
'drive.totalFiles': isAdditional ? 1 : -1,
|
||||||
update.totalUsage = isAdditional ? file.size : -file.size;
|
'drive.incFiles': isAdditional ? 1 : 0,
|
||||||
if (isAdditional) {
|
'drive.incUsage': isAdditional ? fileSizeKb : 0,
|
||||||
update.incFiles = 1;
|
'drive.decFiles': isAdditional ? 1 : 0,
|
||||||
update.incUsage = file.size;
|
'drive.decUsage': isAdditional ? fileSizeKb : 0,
|
||||||
} else {
|
|
||||||
update.decFiles = 1;
|
|
||||||
update.decUsage = file.size;
|
|
||||||
}
|
|
||||||
|
|
||||||
await this.inc({
|
|
||||||
drive: update,
|
|
||||||
}, file.userHost);
|
}, file.userHost);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
import autobind from 'autobind-decorator';
|
|
||||||
import Chart, { DeepPartial } from '../core';
|
|
||||||
import { SchemaType } from '@/misc/schema';
|
|
||||||
import { name, schema } from './entities/network';
|
|
||||||
|
|
||||||
type NetworkLog = SchemaType<typeof schema>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ネットワークに関するチャート
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
|
||||||
export default class NetworkChart extends Chart<NetworkLog> {
|
|
||||||
constructor() {
|
|
||||||
super(name, schema);
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
protected genNewLog(latest: NetworkLog): DeepPartial<NetworkLog> {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
protected aggregate(logs: NetworkLog[]): NetworkLog {
|
|
||||||
return {
|
|
||||||
incomingRequests: logs.reduce((a, b) => a + b.incomingRequests, 0),
|
|
||||||
outgoingRequests: logs.reduce((a, b) => a + b.outgoingRequests, 0),
|
|
||||||
totalTime: logs.reduce((a, b) => a + b.totalTime, 0),
|
|
||||||
incomingBytes: logs.reduce((a, b) => a + b.incomingBytes, 0),
|
|
||||||
outgoingBytes: logs.reduce((a, b) => a + b.outgoingBytes, 0),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
protected async fetchActual(): Promise<DeepPartial<NetworkLog>> {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
public async update(incomingRequests: number, time: number, incomingBytes: number, outgoingBytes: number): Promise<void> {
|
|
||||||
const inc: DeepPartial<NetworkLog> = {
|
|
||||||
incomingRequests: incomingRequests,
|
|
||||||
totalTime: time,
|
|
||||||
incomingBytes: incomingBytes,
|
|
||||||
outgoingBytes: outgoingBytes,
|
|
||||||
};
|
|
||||||
|
|
||||||
await this.inc(inc);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,101 +1,43 @@
|
||||||
import autobind from 'autobind-decorator';
|
import autobind from 'autobind-decorator';
|
||||||
import Chart, { Obj, DeepPartial } from '../core';
|
import Chart, { KVs } from '../core';
|
||||||
import { SchemaType } from '@/misc/schema';
|
|
||||||
import { Notes } from '@/models/index';
|
import { Notes } from '@/models/index';
|
||||||
import { Not, IsNull } from 'typeorm';
|
import { Not, IsNull } from 'typeorm';
|
||||||
import { Note } from '@/models/entities/note';
|
import { Note } from '@/models/entities/note';
|
||||||
import { name, schema } from './entities/notes';
|
import { name, schema } from './entities/notes';
|
||||||
|
|
||||||
type NotesLog = SchemaType<typeof schema>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ノートに関するチャート
|
* ノートに関するチャート
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
export default class NotesChart extends Chart<NotesLog> {
|
export default class NotesChart extends Chart<typeof schema> {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(name, schema);
|
super(name, schema);
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
protected genNewLog(latest: NotesLog): DeepPartial<NotesLog> {
|
protected async queryCurrentState(): Promise<Partial<KVs<typeof schema>>> {
|
||||||
return {
|
|
||||||
local: {
|
|
||||||
total: latest.local.total,
|
|
||||||
},
|
|
||||||
remote: {
|
|
||||||
total: latest.remote.total,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
protected aggregate(logs: NotesLog[]): NotesLog {
|
|
||||||
return {
|
|
||||||
local: {
|
|
||||||
total: logs[0].local.total,
|
|
||||||
inc: logs.reduce((a, b) => a + b.local.inc, 0),
|
|
||||||
dec: logs.reduce((a, b) => a + b.local.dec, 0),
|
|
||||||
diffs: {
|
|
||||||
reply: logs.reduce((a, b) => a + b.local.diffs.reply, 0),
|
|
||||||
renote: logs.reduce((a, b) => a + b.local.diffs.renote, 0),
|
|
||||||
normal: logs.reduce((a, b) => a + b.local.diffs.normal, 0),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
remote: {
|
|
||||||
total: logs[0].remote.total,
|
|
||||||
inc: logs.reduce((a, b) => a + b.remote.inc, 0),
|
|
||||||
dec: logs.reduce((a, b) => a + b.remote.dec, 0),
|
|
||||||
diffs: {
|
|
||||||
reply: logs.reduce((a, b) => a + b.remote.diffs.reply, 0),
|
|
||||||
renote: logs.reduce((a, b) => a + b.remote.diffs.renote, 0),
|
|
||||||
normal: logs.reduce((a, b) => a + b.remote.diffs.normal, 0),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
protected async fetchActual(): Promise<DeepPartial<NotesLog>> {
|
|
||||||
const [localCount, remoteCount] = await Promise.all([
|
const [localCount, remoteCount] = await Promise.all([
|
||||||
Notes.count({ userHost: null }),
|
Notes.count({ userHost: null }),
|
||||||
Notes.count({ userHost: Not(IsNull()) }),
|
Notes.count({ userHost: Not(IsNull()) }),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
local: {
|
'local.total': localCount,
|
||||||
total: localCount,
|
'remote.total': remoteCount,
|
||||||
},
|
|
||||||
remote: {
|
|
||||||
total: remoteCount,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
public async update(note: Note, isAdditional: boolean): Promise<void> {
|
public async update(note: Note, isAdditional: boolean): Promise<void> {
|
||||||
const update: Obj = {
|
const prefix = note.userHost === null ? 'local' : 'remote';
|
||||||
diffs: {},
|
|
||||||
};
|
|
||||||
|
|
||||||
update.total = isAdditional ? 1 : -1;
|
await this.commit({
|
||||||
|
[`${prefix}.total`]: isAdditional ? 1 : -1,
|
||||||
if (isAdditional) {
|
[`${prefix}.inc`]: isAdditional ? 1 : 0,
|
||||||
update.inc = 1;
|
[`${prefix}.dec`]: isAdditional ? 0 : 1,
|
||||||
} else {
|
[`${prefix}.diffs.normal`]: note.replyId == null && note.renoteId == null ? (isAdditional ? 1 : -1) : 0,
|
||||||
update.dec = 1;
|
[`${prefix}.diffs.renote`]: note.renoteId != null ? (isAdditional ? 1 : -1) : 0,
|
||||||
}
|
[`${prefix}.diffs.reply`]: note.replyId != null ? (isAdditional ? 1 : -1) : 0,
|
||||||
|
|
||||||
if (note.replyId != null) {
|
|
||||||
update.diffs.reply = isAdditional ? 1 : -1;
|
|
||||||
} else if (note.renoteId != null) {
|
|
||||||
update.diffs.renote = isAdditional ? 1 : -1;
|
|
||||||
} else {
|
|
||||||
update.diffs.normal = isAdditional ? 1 : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
await this.inc({
|
|
||||||
[note.userHost === null ? 'local' : 'remote']: update,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,68 +1,41 @@
|
||||||
import autobind from 'autobind-decorator';
|
import autobind from 'autobind-decorator';
|
||||||
import Chart, { Obj, DeepPartial } from '../core';
|
import Chart, { KVs } from '../core';
|
||||||
import { SchemaType } from '@/misc/schema';
|
|
||||||
import { DriveFiles } from '@/models/index';
|
import { DriveFiles } from '@/models/index';
|
||||||
import { DriveFile } from '@/models/entities/drive-file';
|
import { DriveFile } from '@/models/entities/drive-file';
|
||||||
import { name, schema } from './entities/per-user-drive';
|
import { name, schema } from './entities/per-user-drive';
|
||||||
|
|
||||||
type PerUserDriveLog = SchemaType<typeof schema>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ユーザーごとのドライブに関するチャート
|
* ユーザーごとのドライブに関するチャート
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
export default class PerUserDriveChart extends Chart<PerUserDriveLog> {
|
export default class PerUserDriveChart extends Chart<typeof schema> {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(name, schema, true);
|
super(name, schema, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
protected genNewLog(latest: PerUserDriveLog): DeepPartial<PerUserDriveLog> {
|
protected async queryCurrentState(group: string): Promise<Partial<KVs<typeof schema>>> {
|
||||||
return {
|
|
||||||
totalCount: latest.totalCount,
|
|
||||||
totalSize: latest.totalSize,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
protected aggregate(logs: PerUserDriveLog[]): PerUserDriveLog {
|
|
||||||
return {
|
|
||||||
totalCount: logs[0].totalCount,
|
|
||||||
totalSize: logs[0].totalSize,
|
|
||||||
incCount: logs.reduce((a, b) => a + b.incCount, 0),
|
|
||||||
incSize: logs.reduce((a, b) => a + b.incSize, 0),
|
|
||||||
decCount: logs.reduce((a, b) => a + b.decCount, 0),
|
|
||||||
decSize: logs.reduce((a, b) => a + b.decSize, 0),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
protected async fetchActual(group: string): Promise<DeepPartial<PerUserDriveLog>> {
|
|
||||||
const [count, size] = await Promise.all([
|
const [count, size] = await Promise.all([
|
||||||
DriveFiles.count({ userId: group }),
|
DriveFiles.count({ userId: group }),
|
||||||
DriveFiles.calcDriveUsageOf(group),
|
DriveFiles.calcDriveUsageOf(group),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
totalCount: count,
|
'totalCount': count,
|
||||||
totalSize: size,
|
'totalSize': size,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
public async update(file: DriveFile, isAdditional: boolean): Promise<void> {
|
public async update(file: DriveFile, isAdditional: boolean): Promise<void> {
|
||||||
const update: Obj = {};
|
const fileSizeKb = file.size / 1000;
|
||||||
|
await this.commit({
|
||||||
update.totalCount = isAdditional ? 1 : -1;
|
'totalCount': isAdditional ? 1 : -1,
|
||||||
update.totalSize = isAdditional ? file.size : -file.size;
|
'totalSize': isAdditional ? fileSizeKb : -fileSizeKb,
|
||||||
if (isAdditional) {
|
'incCount': isAdditional ? 1 : 0,
|
||||||
update.incCount = 1;
|
'incSize': isAdditional ? fileSizeKb : 0,
|
||||||
update.incSize = file.size;
|
'decCount': isAdditional ? 0 : 1,
|
||||||
} else {
|
'decSize': isAdditional ? 0 : fileSizeKb,
|
||||||
update.decCount = 1;
|
}, file.userId);
|
||||||
update.decSize = file.size;
|
|
||||||
}
|
|
||||||
|
|
||||||
await this.inc(update, file.userId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,76 +1,21 @@
|
||||||
import autobind from 'autobind-decorator';
|
import autobind from 'autobind-decorator';
|
||||||
import Chart, { Obj, DeepPartial } from '../core';
|
import Chart, { KVs } from '../core';
|
||||||
import { SchemaType } from '@/misc/schema';
|
|
||||||
import { Followings, Users } from '@/models/index';
|
import { Followings, Users } from '@/models/index';
|
||||||
import { Not, IsNull } from 'typeorm';
|
import { Not, IsNull } from 'typeorm';
|
||||||
import { User } from '@/models/entities/user';
|
import { User } from '@/models/entities/user';
|
||||||
import { name, schema } from './entities/per-user-following';
|
import { name, schema } from './entities/per-user-following';
|
||||||
|
|
||||||
type PerUserFollowingLog = SchemaType<typeof schema>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ユーザーごとのフォローに関するチャート
|
* ユーザーごとのフォローに関するチャート
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
export default class PerUserFollowingChart extends Chart<PerUserFollowingLog> {
|
export default class PerUserFollowingChart extends Chart<typeof schema> {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(name, schema, true);
|
super(name, schema, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
protected genNewLog(latest: PerUserFollowingLog): DeepPartial<PerUserFollowingLog> {
|
protected async queryCurrentState(group: string): Promise<Partial<KVs<typeof schema>>> {
|
||||||
return {
|
|
||||||
local: {
|
|
||||||
followings: {
|
|
||||||
total: latest.local.followings.total,
|
|
||||||
},
|
|
||||||
followers: {
|
|
||||||
total: latest.local.followers.total,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
remote: {
|
|
||||||
followings: {
|
|
||||||
total: latest.remote.followings.total,
|
|
||||||
},
|
|
||||||
followers: {
|
|
||||||
total: latest.remote.followers.total,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
protected aggregate(logs: PerUserFollowingLog[]): PerUserFollowingLog {
|
|
||||||
return {
|
|
||||||
local: {
|
|
||||||
followings: {
|
|
||||||
total: logs[0].local.followings.total,
|
|
||||||
inc: logs.reduce((a, b) => a + b.local.followings.inc, 0),
|
|
||||||
dec: logs.reduce((a, b) => a + b.local.followings.dec, 0),
|
|
||||||
},
|
|
||||||
followers: {
|
|
||||||
total: logs[0].local.followers.total,
|
|
||||||
inc: logs.reduce((a, b) => a + b.local.followers.inc, 0),
|
|
||||||
dec: logs.reduce((a, b) => a + b.local.followers.dec, 0),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
remote: {
|
|
||||||
followings: {
|
|
||||||
total: logs[0].remote.followings.total,
|
|
||||||
inc: logs.reduce((a, b) => a + b.remote.followings.inc, 0),
|
|
||||||
dec: logs.reduce((a, b) => a + b.remote.followings.dec, 0),
|
|
||||||
},
|
|
||||||
followers: {
|
|
||||||
total: logs[0].remote.followers.total,
|
|
||||||
inc: logs.reduce((a, b) => a + b.remote.followers.inc, 0),
|
|
||||||
dec: logs.reduce((a, b) => a + b.remote.followers.dec, 0),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
protected async fetchActual(group: string): Promise<DeepPartial<PerUserFollowingLog>> {
|
|
||||||
const [
|
const [
|
||||||
localFollowingsCount,
|
localFollowingsCount,
|
||||||
localFollowersCount,
|
localFollowersCount,
|
||||||
|
@ -84,42 +29,27 @@ export default class PerUserFollowingChart extends Chart<PerUserFollowingLog> {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
local: {
|
'local.followings.total': localFollowingsCount,
|
||||||
followings: {
|
'local.followers.total': localFollowersCount,
|
||||||
total: localFollowingsCount,
|
'remote.followings.total': remoteFollowingsCount,
|
||||||
},
|
'remote.followers.total': remoteFollowersCount,
|
||||||
followers: {
|
|
||||||
total: localFollowersCount,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
remote: {
|
|
||||||
followings: {
|
|
||||||
total: remoteFollowingsCount,
|
|
||||||
},
|
|
||||||
followers: {
|
|
||||||
total: remoteFollowersCount,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
public async update(follower: { id: User['id']; host: User['host']; }, followee: { id: User['id']; host: User['host']; }, isFollow: boolean): Promise<void> {
|
public async update(follower: { id: User['id']; host: User['host']; }, followee: { id: User['id']; host: User['host']; }, isFollow: boolean): Promise<void> {
|
||||||
const update: Obj = {};
|
const prefixFollower = Users.isLocalUser(follower) ? 'local' : 'remote';
|
||||||
|
const prefixFollowee = Users.isLocalUser(followee) ? 'local' : 'remote';
|
||||||
|
|
||||||
update.total = isFollow ? 1 : -1;
|
this.commit({
|
||||||
|
[`${prefixFollower}.followings.total`]: isFollow ? 1 : -1,
|
||||||
if (isFollow) {
|
[`${prefixFollower}.followings.inc`]: isFollow ? 1 : 0,
|
||||||
update.inc = 1;
|
[`${prefixFollower}.followings.dec`]: isFollow ? 0 : 1,
|
||||||
} else {
|
|
||||||
update.dec = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.inc({
|
|
||||||
[Users.isLocalUser(follower) ? 'local' : 'remote']: { followings: update },
|
|
||||||
}, follower.id);
|
}, follower.id);
|
||||||
this.inc({
|
this.commit({
|
||||||
[Users.isLocalUser(followee) ? 'local' : 'remote']: { followers: update },
|
[`${prefixFollowee}.followers.total`]: isFollow ? 1 : -1,
|
||||||
|
[`${prefixFollowee}.followers.inc`]: isFollow ? 1 : 0,
|
||||||
|
[`${prefixFollowee}.followers.dec`]: isFollow ? 0 : 1,
|
||||||
}, followee.id);
|
}, followee.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,45 +1,21 @@
|
||||||
import autobind from 'autobind-decorator';
|
import autobind from 'autobind-decorator';
|
||||||
import Chart, { Obj, DeepPartial } from '../core';
|
import Chart, { KVs } from '../core';
|
||||||
import { User } from '@/models/entities/user';
|
import { User } from '@/models/entities/user';
|
||||||
import { SchemaType } from '@/misc/schema';
|
|
||||||
import { Notes } from '@/models/index';
|
import { Notes } from '@/models/index';
|
||||||
import { Note } from '@/models/entities/note';
|
import { Note } from '@/models/entities/note';
|
||||||
import { name, schema } from './entities/per-user-notes';
|
import { name, schema } from './entities/per-user-notes';
|
||||||
|
|
||||||
type PerUserNotesLog = SchemaType<typeof schema>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ユーザーごとのノートに関するチャート
|
* ユーザーごとのノートに関するチャート
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
export default class PerUserNotesChart extends Chart<PerUserNotesLog> {
|
export default class PerUserNotesChart extends Chart<typeof schema> {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(name, schema, true);
|
super(name, schema, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
protected genNewLog(latest: PerUserNotesLog): DeepPartial<PerUserNotesLog> {
|
protected async queryCurrentState(group: string): Promise<Partial<KVs<typeof schema>>> {
|
||||||
return {
|
|
||||||
total: latest.total,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
protected aggregate(logs: PerUserNotesLog[]): PerUserNotesLog {
|
|
||||||
return {
|
|
||||||
total: logs[0].total,
|
|
||||||
inc: logs.reduce((a, b) => a + b.inc, 0),
|
|
||||||
dec: logs.reduce((a, b) => a + b.dec, 0),
|
|
||||||
diffs: {
|
|
||||||
reply: logs.reduce((a, b) => a + b.diffs.reply, 0),
|
|
||||||
renote: logs.reduce((a, b) => a + b.diffs.renote, 0),
|
|
||||||
normal: logs.reduce((a, b) => a + b.diffs.normal, 0),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
protected async fetchActual(group: string): Promise<DeepPartial<PerUserNotesLog>> {
|
|
||||||
const [count] = await Promise.all([
|
const [count] = await Promise.all([
|
||||||
Notes.count({ userId: group }),
|
Notes.count({ userId: group }),
|
||||||
]);
|
]);
|
||||||
|
@ -51,26 +27,13 @@ export default class PerUserNotesChart extends Chart<PerUserNotesLog> {
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
public async update(user: { id: User['id'] }, note: Note, isAdditional: boolean): Promise<void> {
|
public async update(user: { id: User['id'] }, note: Note, isAdditional: boolean): Promise<void> {
|
||||||
const update: Obj = {
|
await this.commit({
|
||||||
diffs: {},
|
'total': isAdditional ? 1 : -1,
|
||||||
};
|
'inc': isAdditional ? 1 : 0,
|
||||||
|
'dec': isAdditional ? 0 : 1,
|
||||||
update.total = isAdditional ? 1 : -1;
|
'diffs.normal': note.replyId == null && note.renoteId == null ? (isAdditional ? 1 : -1) : 0,
|
||||||
|
'diffs.renote': note.renoteId != null ? (isAdditional ? 1 : -1) : 0,
|
||||||
if (isAdditional) {
|
'diffs.reply': note.replyId != null ? (isAdditional ? 1 : -1) : 0,
|
||||||
update.inc = 1;
|
}, user.id);
|
||||||
} else {
|
|
||||||
update.dec = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (note.replyId != null) {
|
|
||||||
update.diffs.reply = isAdditional ? 1 : -1;
|
|
||||||
} else if (note.renoteId != null) {
|
|
||||||
update.diffs.renote = isAdditional ? 1 : -1;
|
|
||||||
} else {
|
|
||||||
update.diffs.normal = isAdditional ? 1 : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
await this.inc(update, user.id);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,48 +1,29 @@
|
||||||
import autobind from 'autobind-decorator';
|
import autobind from 'autobind-decorator';
|
||||||
import Chart, { DeepPartial } from '../core';
|
import Chart, { KVs } from '../core';
|
||||||
import { User } from '@/models/entities/user';
|
import { User } from '@/models/entities/user';
|
||||||
import { Note } from '@/models/entities/note';
|
import { Note } from '@/models/entities/note';
|
||||||
import { SchemaType } from '@/misc/schema';
|
|
||||||
import { Users } from '@/models/index';
|
import { Users } from '@/models/index';
|
||||||
import { name, schema } from './entities/per-user-reactions';
|
import { name, schema } from './entities/per-user-reactions';
|
||||||
|
|
||||||
type PerUserReactionsLog = SchemaType<typeof schema>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ユーザーごとのリアクションに関するチャート
|
* ユーザーごとのリアクションに関するチャート
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
export default class PerUserReactionsChart extends Chart<PerUserReactionsLog> {
|
export default class PerUserReactionsChart extends Chart<typeof schema> {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(name, schema, true);
|
super(name, schema, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
protected genNewLog(latest: PerUserReactionsLog): DeepPartial<PerUserReactionsLog> {
|
protected async queryCurrentState(group: string): Promise<Partial<KVs<typeof schema>>> {
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
protected aggregate(logs: PerUserReactionsLog[]): PerUserReactionsLog {
|
|
||||||
return {
|
|
||||||
local: {
|
|
||||||
count: logs.reduce((a, b) => a + b.local.count, 0),
|
|
||||||
},
|
|
||||||
remote: {
|
|
||||||
count: logs.reduce((a, b) => a + b.remote.count, 0),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
protected async fetchActual(group: string): Promise<DeepPartial<PerUserReactionsLog>> {
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
public async update(user: { id: User['id'], host: User['host'] }, note: Note): Promise<void> {
|
public async update(user: { id: User['id'], host: User['host'] }, note: Note): Promise<void> {
|
||||||
this.inc({
|
const prefix = Users.isLocalUser(user) ? 'local' : 'remote';
|
||||||
[Users.isLocalUser(user) ? 'local' : 'remote']: { count: 1 },
|
this.commit({
|
||||||
|
[`${prefix}.count`]: 1,
|
||||||
}, note.userId);
|
}, note.userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
import autobind from 'autobind-decorator';
|
import autobind from 'autobind-decorator';
|
||||||
import Chart, { Obj, DeepPartial } from '../core';
|
import Chart, { KVs } from '../core';
|
||||||
import { SchemaType } from '@/misc/schema';
|
|
||||||
import { name, schema } from './entities/test-grouped';
|
import { name, schema } from './entities/test-grouped';
|
||||||
|
|
||||||
type TestGroupedLog = SchemaType<typeof schema>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For testing
|
* For testing
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
export default class TestGroupedChart extends Chart<TestGroupedLog> {
|
export default class TestGroupedChart extends Chart<typeof schema> {
|
||||||
private total = {} as Record<string, number>;
|
private total = {} as Record<string, number>;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -17,31 +14,9 @@ export default class TestGroupedChart extends Chart<TestGroupedLog> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
protected genNewLog(latest: TestGroupedLog): DeepPartial<TestGroupedLog> {
|
protected async queryCurrentState(group: string): Promise<Partial<KVs<typeof schema>>> {
|
||||||
return {
|
return {
|
||||||
foo: {
|
'foo.total': this.total[group],
|
||||||
total: latest.foo.total,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
protected aggregate(logs: TestGroupedLog[]): TestGroupedLog {
|
|
||||||
return {
|
|
||||||
foo: {
|
|
||||||
total: logs[0].foo.total,
|
|
||||||
inc: logs.reduce((a, b) => a + b.foo.inc, 0),
|
|
||||||
dec: logs.reduce((a, b) => a + b.foo.dec, 0),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
protected async fetchActual(group: string): Promise<DeepPartial<TestGroupedLog>> {
|
|
||||||
return {
|
|
||||||
foo: {
|
|
||||||
total: this.total[group],
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,14 +24,11 @@ export default class TestGroupedChart extends Chart<TestGroupedLog> {
|
||||||
public async increment(group: string): Promise<void> {
|
public async increment(group: string): Promise<void> {
|
||||||
if (this.total[group] == null) this.total[group] = 0;
|
if (this.total[group] == null) this.total[group] = 0;
|
||||||
|
|
||||||
const update: Obj = {};
|
|
||||||
|
|
||||||
update.total = 1;
|
|
||||||
update.inc = 1;
|
|
||||||
this.total[group]++;
|
this.total[group]++;
|
||||||
|
|
||||||
await this.inc({
|
await this.commit({
|
||||||
foo: update,
|
'foo.total': 1,
|
||||||
|
'foo.inc': 1,
|
||||||
}, group);
|
}, group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,39 +1,24 @@
|
||||||
import autobind from 'autobind-decorator';
|
import autobind from 'autobind-decorator';
|
||||||
import Chart, { DeepPartial } from '../core';
|
import Chart, { KVs } from '../core';
|
||||||
import { SchemaType } from '@/misc/schema';
|
|
||||||
import { name, schema } from './entities/test-unique';
|
import { name, schema } from './entities/test-unique';
|
||||||
|
|
||||||
type TestUniqueLog = SchemaType<typeof schema>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For testing
|
* For testing
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
export default class TestUniqueChart extends Chart<TestUniqueLog> {
|
export default class TestUniqueChart extends Chart<typeof schema> {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(name, schema);
|
super(name, schema);
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
protected genNewLog(latest: TestUniqueLog): DeepPartial<TestUniqueLog> {
|
protected async queryCurrentState(): Promise<Partial<KVs<typeof schema>>> {
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
protected aggregate(logs: TestUniqueLog[]): TestUniqueLog {
|
|
||||||
return {
|
|
||||||
foo: logs.reduce((a, b) => a.concat(b.foo), [] as TestUniqueLog['foo']),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
protected async fetchActual(): Promise<DeepPartial<TestUniqueLog>> {
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
public async uniqueIncrement(key: string): Promise<void> {
|
public async uniqueIncrement(key: string): Promise<void> {
|
||||||
await this.inc({
|
await this.commit({
|
||||||
foo: [key],
|
foo: [key],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
import autobind from 'autobind-decorator';
|
import autobind from 'autobind-decorator';
|
||||||
import Chart, { Obj, DeepPartial } from '../core';
|
import Chart, { KVs } from '../core';
|
||||||
import { SchemaType } from '@/misc/schema';
|
|
||||||
import { name, schema } from './entities/test';
|
import { name, schema } from './entities/test';
|
||||||
|
|
||||||
type TestLog = SchemaType<typeof schema>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For testing
|
* For testing
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
export default class TestChart extends Chart<TestLog> {
|
export default class TestChart extends Chart<typeof schema> {
|
||||||
public total = 0; // publicにするのはテストのため
|
public total = 0; // publicにするのはテストのため
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -17,57 +14,29 @@ export default class TestChart extends Chart<TestLog> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
protected genNewLog(latest: TestLog): DeepPartial<TestLog> {
|
protected async queryCurrentState(): Promise<Partial<KVs<typeof schema>>> {
|
||||||
return {
|
return {
|
||||||
foo: {
|
'foo.total': this.total,
|
||||||
total: latest.foo.total,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
protected aggregate(logs: TestLog[]): TestLog {
|
|
||||||
return {
|
|
||||||
foo: {
|
|
||||||
total: logs[0].foo.total,
|
|
||||||
inc: logs.reduce((a, b) => a + b.foo.inc, 0),
|
|
||||||
dec: logs.reduce((a, b) => a + b.foo.dec, 0),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
protected async fetchActual(): Promise<DeepPartial<TestLog>> {
|
|
||||||
return {
|
|
||||||
foo: {
|
|
||||||
total: this.total,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
public async increment(): Promise<void> {
|
public async increment(): Promise<void> {
|
||||||
const update: Obj = {};
|
|
||||||
|
|
||||||
update.total = 1;
|
|
||||||
update.inc = 1;
|
|
||||||
this.total++;
|
this.total++;
|
||||||
|
|
||||||
await this.inc({
|
await this.commit({
|
||||||
foo: update,
|
'foo.total': 1,
|
||||||
|
'foo.inc': 1,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
public async decrement(): Promise<void> {
|
public async decrement(): Promise<void> {
|
||||||
const update: Obj = {};
|
|
||||||
|
|
||||||
update.total = -1;
|
|
||||||
update.dec = 1;
|
|
||||||
this.total--;
|
this.total--;
|
||||||
|
|
||||||
await this.inc({
|
await this.commit({
|
||||||
foo: update,
|
'foo.total': -1,
|
||||||
|
'foo.dec': 1,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,80 +1,40 @@
|
||||||
import autobind from 'autobind-decorator';
|
import autobind from 'autobind-decorator';
|
||||||
import Chart, { Obj, DeepPartial } from '../core';
|
import Chart, { KVs } from '../core';
|
||||||
import { SchemaType } from '@/misc/schema';
|
|
||||||
import { Users } from '@/models/index';
|
import { Users } from '@/models/index';
|
||||||
import { Not, IsNull } from 'typeorm';
|
import { Not, IsNull } from 'typeorm';
|
||||||
import { User } from '@/models/entities/user';
|
import { User } from '@/models/entities/user';
|
||||||
import { name, schema } from './entities/users';
|
import { name, schema } from './entities/users';
|
||||||
|
|
||||||
type UsersLog = SchemaType<typeof schema>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ユーザー数に関するチャート
|
* ユーザー数に関するチャート
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
export default class UsersChart extends Chart<UsersLog> {
|
export default class UsersChart extends Chart<typeof schema> {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(name, schema);
|
super(name, schema);
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
protected genNewLog(latest: UsersLog): DeepPartial<UsersLog> {
|
protected async queryCurrentState(): Promise<Partial<KVs<typeof schema>>> {
|
||||||
return {
|
|
||||||
local: {
|
|
||||||
total: latest.local.total,
|
|
||||||
},
|
|
||||||
remote: {
|
|
||||||
total: latest.remote.total,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
protected aggregate(logs: UsersLog[]): UsersLog {
|
|
||||||
return {
|
|
||||||
local: {
|
|
||||||
total: logs[0].local.total,
|
|
||||||
inc: logs.reduce((a, b) => a + b.local.inc, 0),
|
|
||||||
dec: logs.reduce((a, b) => a + b.local.dec, 0),
|
|
||||||
},
|
|
||||||
remote: {
|
|
||||||
total: logs[0].remote.total,
|
|
||||||
inc: logs.reduce((a, b) => a + b.remote.inc, 0),
|
|
||||||
dec: logs.reduce((a, b) => a + b.remote.dec, 0),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
protected async fetchActual(): Promise<DeepPartial<UsersLog>> {
|
|
||||||
const [localCount, remoteCount] = await Promise.all([
|
const [localCount, remoteCount] = await Promise.all([
|
||||||
Users.count({ host: null }),
|
Users.count({ host: null }),
|
||||||
Users.count({ host: Not(IsNull()) }),
|
Users.count({ host: Not(IsNull()) }),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
local: {
|
'local.total': localCount,
|
||||||
total: localCount,
|
'remote.total': remoteCount,
|
||||||
},
|
|
||||||
remote: {
|
|
||||||
total: remoteCount,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
public async update(user: { id: User['id'], host: User['host'] }, isAdditional: boolean): Promise<void> {
|
public async update(user: { id: User['id'], host: User['host'] }, isAdditional: boolean): Promise<void> {
|
||||||
const update: Obj = {};
|
const prefix = Users.isLocalUser(user) ? 'local' : 'remote';
|
||||||
|
|
||||||
update.total = isAdditional ? 1 : -1;
|
await this.commit({
|
||||||
if (isAdditional) {
|
[`${prefix}.total`]: isAdditional ? 1 : -1,
|
||||||
update.inc = 1;
|
[`${prefix}.inc`]: isAdditional ? 1 : 0,
|
||||||
} else {
|
[`${prefix}.dec`]: isAdditional ? 0 : 1,
|
||||||
update.dec = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
await this.inc({
|
|
||||||
[Users.isLocalUser(user) ? 'local' : 'remote']: update,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,24 +7,19 @@
|
||||||
import * as nestedProperty from 'nested-property';
|
import * as nestedProperty from 'nested-property';
|
||||||
import autobind from 'autobind-decorator';
|
import autobind from 'autobind-decorator';
|
||||||
import Logger from '../logger';
|
import Logger from '../logger';
|
||||||
import { Schema } from '@/misc/schema';
|
|
||||||
import { EntitySchema, getRepository, Repository, LessThan, Between } from 'typeorm';
|
import { EntitySchema, getRepository, Repository, LessThan, Between } from 'typeorm';
|
||||||
import { dateUTC, isTimeSame, isTimeBefore, subtractTime, addTime } from '@/prelude/time';
|
import { dateUTC, isTimeSame, isTimeBefore, subtractTime, addTime } from '@/prelude/time';
|
||||||
import { getChartInsertLock } from '@/misc/app-lock';
|
import { getChartInsertLock } from '@/misc/app-lock';
|
||||||
|
|
||||||
const logger = new Logger('chart', 'white', process.env.NODE_ENV !== 'test');
|
const logger = new Logger('chart', 'white', process.env.NODE_ENV !== 'test');
|
||||||
|
|
||||||
export type Obj = { [key: string]: any };
|
const columnPrefix = '___' as const;
|
||||||
|
const uniqueTempColumnPrefix = 'unique_temp___' as const;
|
||||||
|
const columnDot = '_' as const;
|
||||||
|
|
||||||
export type DeepPartial<T> = {
|
type KeyToColumnName<T extends string> = T extends `${infer R1}.${infer R2}` ? `${R1}${typeof columnDot}${KeyToColumnName<R2>}` : T;
|
||||||
[P in keyof T]?: DeepPartial<T[P]>;
|
|
||||||
};
|
|
||||||
|
|
||||||
type ArrayValue<T> = {
|
type RawRecord<S extends Schema> = {
|
||||||
[P in keyof T]: T[P] extends number ? T[P][] : ArrayValue<T[P]>;
|
|
||||||
};
|
|
||||||
|
|
||||||
type Log = {
|
|
||||||
id: number;
|
id: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -36,6 +31,10 @@ type Log = {
|
||||||
* 集計日時のUnixタイムスタンプ(秒)
|
* 集計日時のUnixタイムスタンプ(秒)
|
||||||
*/
|
*/
|
||||||
date: number;
|
date: number;
|
||||||
|
} & {
|
||||||
|
[K in keyof S as `${typeof uniqueTempColumnPrefix}${KeyToColumnName<string & K>}`]: S[K]['uniqueIncrement'] extends true ? string[] : never;
|
||||||
|
} & {
|
||||||
|
[K in keyof S as `${typeof columnPrefix}${KeyToColumnName<string & K>}`]: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
const camelToSnake = (str: string): string => {
|
const camelToSnake = (str: string): string => {
|
||||||
|
@ -44,123 +43,72 @@ const camelToSnake = (str: string): string => {
|
||||||
|
|
||||||
const removeDuplicates = (array: any[]) => Array.from(new Set(array));
|
const removeDuplicates = (array: any[]) => Array.from(new Set(array));
|
||||||
|
|
||||||
|
type Schema = Record<string, {
|
||||||
|
uniqueIncrement?: boolean;
|
||||||
|
|
||||||
|
range?: 'big' | 'small' | 'medium';
|
||||||
|
|
||||||
|
// previousな値を引き継ぐかどうか
|
||||||
|
accumulate?: boolean;
|
||||||
|
}>;
|
||||||
|
|
||||||
|
type Commit<S extends Schema> = {
|
||||||
|
[K in keyof S]?: S[K]['uniqueIncrement'] extends true ? string[] : number;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KVs<S extends Schema> = {
|
||||||
|
[K in keyof S]: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
type ChartResult<T extends Schema> = {
|
||||||
|
[P in keyof T]: number[];
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 様々なチャートの管理を司るクラス
|
* 様々なチャートの管理を司るクラス
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
export default abstract class Chart<T extends Record<string, any>> {
|
export default abstract class Chart<T extends Schema> {
|
||||||
private static readonly columnPrefix = '___';
|
public schema: T;
|
||||||
private static readonly columnDot = '_';
|
|
||||||
|
|
||||||
private name: string;
|
private name: string;
|
||||||
private buffer: {
|
private buffer: {
|
||||||
diff: DeepPartial<T>;
|
diff: Commit<T>;
|
||||||
group: string | null;
|
group: string | null;
|
||||||
}[] = [];
|
}[] = [];
|
||||||
public schema: Schema;
|
protected repositoryForHour: Repository<RawRecord<T>>;
|
||||||
protected repositoryForHour: Repository<Log>;
|
protected repositoryForDay: Repository<RawRecord<T>>;
|
||||||
protected repositoryForDay: Repository<Log>;
|
|
||||||
|
|
||||||
protected abstract genNewLog(latest: T): DeepPartial<T>;
|
protected abstract queryCurrentState(group: string | null): Promise<Partial<KVs<T>>>;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param logs 日時が新しい方が先頭
|
|
||||||
*/
|
|
||||||
protected abstract aggregate(logs: T[]): T;
|
|
||||||
|
|
||||||
protected abstract fetchActual(group: string | null): Promise<DeepPartial<T>>;
|
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
private static convertSchemaToFlatColumnDefinitions(schema: Schema) {
|
private static convertSchemaToColumnDefinitions(schema: Schema): Record<string, { type: string; array?: boolean; default?: any; }> {
|
||||||
const columns = {} as Record<string, unknown>;
|
const columns = {} as Record<string, { type: string; array?: boolean; default?: any; }>;
|
||||||
const flatColumns = (x: Obj, path?: string) => {
|
for (const [k, v] of Object.entries(schema)) {
|
||||||
for (const [k, v] of Object.entries(x)) {
|
const name = k.replaceAll('.', columnDot);
|
||||||
const p = path ? `${path}${this.columnDot}${k}` : k;
|
const type = v.range === 'big' ? 'bigint' : v.range === 'small' ? 'smallint' : 'integer';
|
||||||
if (v.type === 'object') {
|
if (v.uniqueIncrement) {
|
||||||
flatColumns(v.properties, p);
|
columns[uniqueTempColumnPrefix + name] = {
|
||||||
} else if (v.type === 'number') {
|
type: 'varchar',
|
||||||
columns[this.columnPrefix + p] = {
|
array: true,
|
||||||
type: 'bigint',
|
default: '{}',
|
||||||
};
|
};
|
||||||
} else if (v.type === 'array' && v.items.type === 'string') {
|
columns[columnPrefix + name] = {
|
||||||
columns[this.columnPrefix + p] = {
|
type,
|
||||||
type: 'varchar',
|
default: 0,
|
||||||
array: true,
|
};
|
||||||
};
|
} else {
|
||||||
}
|
columns[columnPrefix + name] = {
|
||||||
|
type,
|
||||||
|
default: 0,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
flatColumns(schema.properties!);
|
|
||||||
return columns;
|
return columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
private static convertFlattenColumnsToObject(x: Record<string, unknown>): Record<string, unknown> {
|
private static dateToTimestamp(x: Date): number {
|
||||||
const obj = {} as Record<string, unknown>;
|
|
||||||
for (const k of Object.keys(x).filter(k => k.startsWith(Chart.columnPrefix))) {
|
|
||||||
// now k is ___x_y_z
|
|
||||||
const path = k.substr(Chart.columnPrefix.length).split(Chart.columnDot).join('.');
|
|
||||||
nestedProperty.set(obj, path, x[k]);
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
private static convertObjectToFlattenColumns(x: Record<string, unknown>) {
|
|
||||||
const columns = {} as Record<string, number | unknown[]>;
|
|
||||||
const flatten = (x: Obj, path?: string) => {
|
|
||||||
for (const [k, v] of Object.entries(x)) {
|
|
||||||
const p = path ? `${path}${this.columnDot}${k}` : k;
|
|
||||||
if (typeof v === 'object' && !Array.isArray(v)) {
|
|
||||||
flatten(v, p);
|
|
||||||
} else {
|
|
||||||
columns[this.columnPrefix + p] = v;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
flatten(x);
|
|
||||||
return columns;
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
private static countUniqueFields(x: Record<string, unknown>) {
|
|
||||||
const exec = (x: Obj) => {
|
|
||||||
const res = {} as Record<string, unknown>;
|
|
||||||
for (const [k, v] of Object.entries(x)) {
|
|
||||||
if (typeof v === 'object' && !Array.isArray(v)) {
|
|
||||||
res[k] = exec(v);
|
|
||||||
} else if (Array.isArray(v)) {
|
|
||||||
res[k] = Array.from(new Set(v)).length;
|
|
||||||
} else {
|
|
||||||
res[k] = v;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
};
|
|
||||||
return exec(x);
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
private static convertQuery(diff: Record<string, number | unknown[]>) {
|
|
||||||
const query: Record<string, () => string> = {};
|
|
||||||
|
|
||||||
for (const [k, v] of Object.entries(diff)) {
|
|
||||||
if (typeof v === 'number') {
|
|
||||||
if (v > 0) query[k] = () => `"${k}" + ${v}`;
|
|
||||||
if (v < 0) query[k] = () => `"${k}" - ${Math.abs(v)}`;
|
|
||||||
} else if (Array.isArray(v)) {
|
|
||||||
// TODO: item が文字列以外の場合も対応
|
|
||||||
// TODO: item をSQLエスケープ
|
|
||||||
const items = v.map(item => `"${item}"`).join(',');
|
|
||||||
query[k] = () => `array_cat("${k}", '{${items}}'::varchar[])`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
private static dateToTimestamp(x: Date): Log['date'] {
|
|
||||||
return Math.floor(x.getTime() / 1000);
|
return Math.floor(x.getTime() / 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,7 +155,7 @@ export default abstract class Chart<T extends Record<string, any>> {
|
||||||
length: 128,
|
length: 128,
|
||||||
},
|
},
|
||||||
} : {}),
|
} : {}),
|
||||||
...Chart.convertSchemaToFlatColumnDefinitions(schema),
|
...Chart.convertSchemaToColumnDefinitions(schema),
|
||||||
},
|
},
|
||||||
indices: [{
|
indices: [{
|
||||||
columns: grouped ? ['date', 'group'] : ['date'],
|
columns: grouped ? ['date', 'group'] : ['date'],
|
||||||
|
@ -233,37 +181,39 @@ export default abstract class Chart<T extends Record<string, any>> {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(name: string, schema: Schema, grouped = false) {
|
constructor(name: string, schema: T, grouped = false) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.schema = schema;
|
this.schema = schema;
|
||||||
|
|
||||||
const { hour, day } = Chart.schemaToEntity(name, schema, grouped);
|
const { hour, day } = Chart.schemaToEntity(name, schema, grouped);
|
||||||
this.repositoryForHour = getRepository<Log>(hour);
|
this.repositoryForHour = getRepository<RawRecord<T>>(hour);
|
||||||
this.repositoryForDay = getRepository<Log>(day);
|
this.repositoryForDay = getRepository<RawRecord<T>>(day);
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
private getNewLog(latest: T | null): T {
|
private convertRawRecord(x: RawRecord<T>): KVs<T> {
|
||||||
const log = latest ? this.genNewLog(latest) : {};
|
const kvs = {} as KVs<T>;
|
||||||
const flatColumns = (x: Obj, path?: string) => {
|
for (const k of Object.keys(x).filter(k => k.startsWith(columnPrefix))) {
|
||||||
for (const [k, v] of Object.entries(x)) {
|
kvs[k.substr(columnPrefix.length).split(columnDot).join('.')] = x[k];
|
||||||
const p = path ? `${path}.${k}` : k;
|
}
|
||||||
if (v.type === 'object') {
|
return kvs;
|
||||||
flatColumns(v.properties, p);
|
}
|
||||||
} else {
|
|
||||||
if (nestedProperty.get(log, p) == null) {
|
@autobind
|
||||||
const emptyValue = v.type === 'number' ? 0 : [];
|
private getNewLog(latest: KVs<T> | null): KVs<T> {
|
||||||
nestedProperty.set(log, p, emptyValue);
|
const log = {} as Record<keyof T, number>;
|
||||||
}
|
for (const [k, v] of Object.entries(this.schema)) {
|
||||||
}
|
if (v.accumulate && latest) {
|
||||||
|
log[k] = latest[k];
|
||||||
|
} else {
|
||||||
|
log[k] = 0;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
flatColumns(this.schema.properties!);
|
return log as KVs<T>;
|
||||||
return log as T;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
private getLatestLog(group: string | null, span: 'hour' | 'day'): Promise<Log | null> {
|
private getLatestLog(group: string | null, span: 'hour' | 'day'): Promise<RawRecord<T> | null> {
|
||||||
const repository =
|
const repository =
|
||||||
span === 'hour' ? this.repositoryForHour :
|
span === 'hour' ? this.repositoryForHour :
|
||||||
span === 'day' ? this.repositoryForDay :
|
span === 'day' ? this.repositoryForDay :
|
||||||
|
@ -282,7 +232,7 @@ export default abstract class Chart<T extends Record<string, any>> {
|
||||||
* 現在(=今のHour or Day)のログをデータベースから探して、あればそれを返し、なければ作成して返します。
|
* 現在(=今のHour or Day)のログをデータベースから探して、あればそれを返し、なければ作成して返します。
|
||||||
*/
|
*/
|
||||||
@autobind
|
@autobind
|
||||||
private async claimCurrentLog(group: string | null, span: 'hour' | 'day'): Promise<Log> {
|
private async claimCurrentLog(group: string | null, span: 'hour' | 'day'): Promise<RawRecord<T>> {
|
||||||
const [y, m, d, h] = Chart.getCurrentDate();
|
const [y, m, d, h] = Chart.getCurrentDate();
|
||||||
|
|
||||||
const current = dateUTC(
|
const current = dateUTC(
|
||||||
|
@ -306,8 +256,8 @@ export default abstract class Chart<T extends Record<string, any>> {
|
||||||
return currentLog;
|
return currentLog;
|
||||||
}
|
}
|
||||||
|
|
||||||
let log: Log;
|
let log: RawRecord<T>;
|
||||||
let data: T;
|
let data: KVs<T>;
|
||||||
|
|
||||||
// 集計期間が変わってから、初めてのチャート更新なら
|
// 集計期間が変わってから、初めてのチャート更新なら
|
||||||
// 最も最近のログを持ってくる
|
// 最も最近のログを持ってくる
|
||||||
|
@ -318,10 +268,8 @@ export default abstract class Chart<T extends Record<string, any>> {
|
||||||
const latest = await this.getLatestLog(group, span);
|
const latest = await this.getLatestLog(group, span);
|
||||||
|
|
||||||
if (latest != null) {
|
if (latest != null) {
|
||||||
const obj = Chart.convertFlattenColumnsToObject(latest) as T;
|
|
||||||
|
|
||||||
// 空ログデータを作成
|
// 空ログデータを作成
|
||||||
data = this.getNewLog(obj);
|
data = this.getNewLog(this.convertRawRecord(latest));
|
||||||
} else {
|
} else {
|
||||||
// ログが存在しなかったら
|
// ログが存在しなかったら
|
||||||
// (Misskeyインスタンスを建てて初めてのチャート更新時など)
|
// (Misskeyインスタンスを建てて初めてのチャート更新時など)
|
||||||
|
@ -346,11 +294,17 @@ export default abstract class Chart<T extends Record<string, any>> {
|
||||||
// ログがあればそれを返して終了
|
// ログがあればそれを返して終了
|
||||||
if (currentLog != null) return currentLog;
|
if (currentLog != null) return currentLog;
|
||||||
|
|
||||||
|
const columns = {} as Record<string, number | unknown[]>;
|
||||||
|
for (const [k, v] of Object.entries(data)) {
|
||||||
|
const name = k.replaceAll('.', columnDot);
|
||||||
|
columns[columnPrefix + name] = v;
|
||||||
|
}
|
||||||
|
|
||||||
// 新規ログ挿入
|
// 新規ログ挿入
|
||||||
log = await repository.insert({
|
log = await repository.insert({
|
||||||
date: date,
|
date: date,
|
||||||
...(group ? { group: group } : {}),
|
...(group ? { group: group } : {}),
|
||||||
...Chart.convertObjectToFlattenColumns(data),
|
...columns,
|
||||||
}).then(x => repository.findOneOrFail(x.identifiers[0]));
|
}).then(x => repository.findOneOrFail(x.identifiers[0]));
|
||||||
|
|
||||||
logger.info(`${this.name + (group ? `:${group}` : '')}(${span}): New commit created`);
|
logger.info(`${this.name + (group ? `:${group}` : '')}(${span}): New commit created`);
|
||||||
|
@ -362,7 +316,10 @@ export default abstract class Chart<T extends Record<string, any>> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
protected commit(diff: DeepPartial<T>, group: string | null = null): void {
|
protected commit(diff: Commit<T>, group: string | null = null): void {
|
||||||
|
for (const [k, v] of Object.entries(diff)) {
|
||||||
|
if (v == null || v === 0 || (Array.isArray(v) && v.length === 0)) delete diff[k];
|
||||||
|
}
|
||||||
this.buffer.push({
|
this.buffer.push({
|
||||||
diff, group,
|
diff, group,
|
||||||
});
|
});
|
||||||
|
@ -381,13 +338,11 @@ export default abstract class Chart<T extends Record<string, any>> {
|
||||||
// そのログは本来は 01:00~ のログとしてDBに保存されて欲しいのに、02:00~ のログ扱いになってしまう。
|
// そのログは本来は 01:00~ のログとしてDBに保存されて欲しいのに、02:00~ のログ扱いになってしまう。
|
||||||
// これを回避するための実装は複雑になりそうなため、一旦保留。
|
// これを回避するための実装は複雑になりそうなため、一旦保留。
|
||||||
|
|
||||||
const update = async (logHour: Log, logDay: Log): Promise<void> => {
|
const update = async (logHour: RawRecord<T>, logDay: RawRecord<T>): Promise<void> => {
|
||||||
const finalDiffs = {} as Record<string, number | unknown[]>;
|
const finalDiffs = {} as Record<string, number | unknown[]>;
|
||||||
|
|
||||||
for (const diff of this.buffer.filter(q => q.group == null || (q.group === logHour.group)).map(q => q.diff)) {
|
for (const diff of this.buffer.filter(q => q.group == null || (q.group === logHour.group)).map(q => q.diff)) {
|
||||||
const columns = Chart.convertObjectToFlattenColumns(diff);
|
for (const [k, v] of Object.entries(diff)) {
|
||||||
|
|
||||||
for (const [k, v] of Object.entries(columns)) {
|
|
||||||
if (finalDiffs[k] == null) {
|
if (finalDiffs[k] == null) {
|
||||||
finalDiffs[k] = v;
|
finalDiffs[k] = v;
|
||||||
} else {
|
} else {
|
||||||
|
@ -400,18 +355,45 @@ export default abstract class Chart<T extends Record<string, any>> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const query = Chart.convertQuery(finalDiffs);
|
const queryForHour: Record<string, number | (() => string)> = {};
|
||||||
|
const queryForDay: Record<string, number | (() => string)> = {};
|
||||||
|
for (const [k, v] of Object.entries(finalDiffs)) {
|
||||||
|
if (typeof v === 'number') {
|
||||||
|
const name = columnPrefix + k.replaceAll('.', columnDot);
|
||||||
|
if (v > 0) queryForHour[name] = () => `"${name}" + ${v}`;
|
||||||
|
if (v < 0) queryForHour[name] = () => `"${name}" - ${Math.abs(v)}`;
|
||||||
|
if (v > 0) queryForDay[name] = () => `"${name}" + ${v}`;
|
||||||
|
if (v < 0) queryForDay[name] = () => `"${name}" - ${Math.abs(v)}`;
|
||||||
|
} else if (Array.isArray(v) && v.length > 0) { // ユニークインクリメント
|
||||||
|
const name = uniqueTempColumnPrefix + k.replaceAll('.', columnDot);
|
||||||
|
// TODO: item が文字列以外の場合も対応
|
||||||
|
// TODO: item をSQLエスケープ
|
||||||
|
// TODO: 値が重複しないようにしたい
|
||||||
|
const items = v.map(item => `"${item}"`).join(',');
|
||||||
|
queryForHour[name] = () => `array_cat("${name}", '{${items}}'::varchar[])`;
|
||||||
|
queryForDay[name] = () => `array_cat("${name}", '{${items}}'::varchar[])`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const [k, v] of Object.entries(this.schema)) {
|
||||||
|
const name = columnPrefix + k.replaceAll('.', columnDot);
|
||||||
|
if (v.uniqueIncrement) {
|
||||||
|
const tempColumnName = uniqueTempColumnPrefix + k.replaceAll('.', columnDot);
|
||||||
|
queryForHour[name] = new Set([...finalDiffs[k], ...logHour[tempColumnName]]).size;
|
||||||
|
queryForDay[name] = new Set([...finalDiffs[k], ...logDay[tempColumnName]]).size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ログ更新
|
// ログ更新
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
this.repositoryForHour.createQueryBuilder()
|
this.repositoryForHour.createQueryBuilder()
|
||||||
.update()
|
.update()
|
||||||
.set(query)
|
.set(queryForHour)
|
||||||
.where('id = :id', { id: logHour.id })
|
.where('id = :id', { id: logHour.id })
|
||||||
.execute(),
|
.execute(),
|
||||||
this.repositoryForDay.createQueryBuilder()
|
this.repositoryForDay.createQueryBuilder()
|
||||||
.update()
|
.update()
|
||||||
.set(query)
|
.set(queryForDay)
|
||||||
.where('id = :id', { id: logDay.id })
|
.where('id = :id', { id: logDay.id })
|
||||||
.execute(),
|
.execute(),
|
||||||
]);
|
]);
|
||||||
|
@ -435,18 +417,24 @@ export default abstract class Chart<T extends Record<string, any>> {
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
public async resync(group: string | null = null): Promise<void> {
|
public async resync(group: string | null = null): Promise<void> {
|
||||||
const data = await this.fetchActual(group);
|
const data = await this.queryCurrentState(group);
|
||||||
|
|
||||||
const update = async (logHour: Log, logDay: Log): Promise<void> => {
|
const columns = {} as Record<string, number>;
|
||||||
|
for (const [k, v] of Object.entries(data)) {
|
||||||
|
const name = k.replaceAll('.', columnDot);
|
||||||
|
columns[columnPrefix + name] = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
const update = async (logHour: RawRecord<T>, logDay: RawRecord<T>): Promise<void> => {
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
this.repositoryForHour.createQueryBuilder()
|
this.repositoryForHour.createQueryBuilder()
|
||||||
.update()
|
.update()
|
||||||
.set(Chart.convertObjectToFlattenColumns(data))
|
.set(columns as any)
|
||||||
.where('id = :id', { id: logHour.id })
|
.where('id = :id', { id: logHour.id })
|
||||||
.execute(),
|
.execute(),
|
||||||
this.repositoryForDay.createQueryBuilder()
|
this.repositoryForDay.createQueryBuilder()
|
||||||
.update()
|
.update()
|
||||||
.set(Chart.convertObjectToFlattenColumns(data))
|
.set(columns as any)
|
||||||
.where('id = :id', { id: logDay.id })
|
.where('id = :id', { id: logDay.id })
|
||||||
.execute(),
|
.execute(),
|
||||||
]);
|
]);
|
||||||
|
@ -460,12 +448,39 @@ export default abstract class Chart<T extends Record<string, any>> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
protected async inc(inc: DeepPartial<T>, group: string | null = null): Promise<void> {
|
public async clean(): Promise<void> {
|
||||||
await this.commit(inc, group);
|
const current = dateUTC(Chart.getCurrentDate());
|
||||||
|
|
||||||
|
// 一日以上前かつ三日以内
|
||||||
|
const gt = Chart.dateToTimestamp(current) - (1000 * 60 * 60 * 24 * 3);
|
||||||
|
const lt = Chart.dateToTimestamp(current) - (1000 * 60 * 60 * 24);
|
||||||
|
|
||||||
|
const columns = {} as Record<string, number>;
|
||||||
|
for (const [k, v] of Object.entries(this.schema)) {
|
||||||
|
if (v.uniqueIncrement) {
|
||||||
|
const name = k.replaceAll('.', columnDot);
|
||||||
|
columns[uniqueTempColumnPrefix + name] = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await Promise.all([
|
||||||
|
this.repositoryForHour.createQueryBuilder()
|
||||||
|
.update()
|
||||||
|
.set(columns as any)
|
||||||
|
.where('date > :gt', { gt })
|
||||||
|
.andWhere('date < :lt', { lt })
|
||||||
|
.execute(),
|
||||||
|
this.repositoryForDay.createQueryBuilder()
|
||||||
|
.update()
|
||||||
|
.set(columns as any)
|
||||||
|
.where('date > :gt', { gt })
|
||||||
|
.andWhere('date < :lt', { lt })
|
||||||
|
.execute(),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
public async getChart(span: 'hour' | 'day', amount: number, cursor: Date | null, group: string | null = null): Promise<ArrayValue<T>> {
|
public async getChartRaw(span: 'hour' | 'day', amount: number, cursor: Date | null, group: string | null = null): Promise<ChartResult<T>> {
|
||||||
const [y, m, d, h, _m, _s, _ms] = cursor ? Chart.parseDate(subtractTime(addTime(cursor, 1, span), 1)) : Chart.getCurrentDate();
|
const [y, m, d, h, _m, _s, _ms] = cursor ? Chart.parseDate(subtractTime(addTime(cursor, 1, span), 1)) : Chart.getCurrentDate();
|
||||||
const [y2, m2, d2, h2] = cursor ? Chart.parseDate(addTime(cursor, 1, span)) : [] as never;
|
const [y2, m2, d2, h2] = cursor ? Chart.parseDate(addTime(cursor, 1, span)) : [] as never;
|
||||||
|
|
||||||
|
@ -526,7 +541,7 @@ export default abstract class Chart<T extends Record<string, any>> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const chart: T[] = [];
|
const chart: KVs<T>[] = [];
|
||||||
|
|
||||||
for (let i = (amount - 1); i >= 0; i--) {
|
for (let i = (amount - 1); i >= 0; i--) {
|
||||||
const current =
|
const current =
|
||||||
|
@ -537,17 +552,16 @@ export default abstract class Chart<T extends Record<string, any>> {
|
||||||
const log = logs.find(l => isTimeSame(new Date(l.date * 1000), current));
|
const log = logs.find(l => isTimeSame(new Date(l.date * 1000), current));
|
||||||
|
|
||||||
if (log) {
|
if (log) {
|
||||||
const data = Chart.convertFlattenColumnsToObject(log);
|
chart.unshift(this.convertRawRecord(log));
|
||||||
chart.unshift(Chart.countUniqueFields(data) as T);
|
|
||||||
} else {
|
} else {
|
||||||
// 隙間埋め
|
// 隙間埋め
|
||||||
const latest = logs.find(l => isTimeBefore(new Date(l.date * 1000), current));
|
const latest = logs.find(l => isTimeBefore(new Date(l.date * 1000), current));
|
||||||
const data = latest ? Chart.convertFlattenColumnsToObject(latest) as T : null;
|
const data = latest ? this.convertRawRecord(latest) : null;
|
||||||
chart.unshift(Chart.countUniqueFields(this.getNewLog(data)) as T);
|
chart.unshift(this.getNewLog(data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = {} as Record<string, unknown>;
|
const res = {} as ChartResult<T>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [{ foo: 1, bar: 5 }, { foo: 2, bar: 6 }, { foo: 3, bar: 7 }]
|
* [{ foo: 1, bar: 5 }, { foo: 2, bar: 6 }, { foo: 3, bar: 7 }]
|
||||||
|
@ -555,36 +569,26 @@ export default abstract class Chart<T extends Record<string, any>> {
|
||||||
* { foo: [1, 2, 3], bar: [5, 6, 7] }
|
* { foo: [1, 2, 3], bar: [5, 6, 7] }
|
||||||
* にする
|
* にする
|
||||||
*/
|
*/
|
||||||
const compact = (x: Obj, path?: string): void => {
|
for (const record of chart) {
|
||||||
for (const [k, v] of Object.entries(x)) {
|
for (const [k, v] of Object.entries(record)) {
|
||||||
const p = path ? `${path}.${k}` : k;
|
if (res[k]) {
|
||||||
if (typeof v === 'object' && !Array.isArray(v)) {
|
res[k].push(v);
|
||||||
compact(v, p);
|
|
||||||
} else {
|
} else {
|
||||||
const values = chart.map(s => nestedProperty.get(s, p));
|
res[k] = [v];
|
||||||
nestedProperty.set(res, p, values);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
compact(chart[0]);
|
|
||||||
|
|
||||||
return res as ArrayValue<T>;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function convertLog(logSchema: Schema): Schema {
|
|
||||||
const v: Schema = JSON.parse(JSON.stringify(logSchema)); // copy
|
|
||||||
if (v.type === 'number') {
|
|
||||||
v.type = 'array';
|
|
||||||
v.items = {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
};
|
|
||||||
} else if (v.type === 'object') {
|
|
||||||
for (const k of Object.keys(v.properties!)) {
|
|
||||||
v.properties![k] = convertLog(v.properties![k]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@autobind
|
||||||
|
public async getChart(span: 'hour' | 'day', amount: number, cursor: Date | null, group: string | null = null): Promise<Record<string, unknown>> {
|
||||||
|
const result = await this.getChartRaw(span, amount, cursor, group);
|
||||||
|
const object = {};
|
||||||
|
for (const [k, v] of Object.entries(result)) {
|
||||||
|
nestedProperty.set(object, k, v);
|
||||||
|
}
|
||||||
|
return object;
|
||||||
}
|
}
|
||||||
return v;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { entity as FederationChart } from './charts/entities/federation';
|
import { entity as FederationChart } from './charts/entities/federation';
|
||||||
import { entity as NotesChart } from './charts/entities/notes';
|
import { entity as NotesChart } from './charts/entities/notes';
|
||||||
import { entity as UsersChart } from './charts/entities/users';
|
import { entity as UsersChart } from './charts/entities/users';
|
||||||
import { entity as NetworkChart } from './charts/entities/network';
|
|
||||||
import { entity as ActiveUsersChart } from './charts/entities/active-users';
|
import { entity as ActiveUsersChart } from './charts/entities/active-users';
|
||||||
import { entity as InstanceChart } from './charts/entities/instance';
|
import { entity as InstanceChart } from './charts/entities/instance';
|
||||||
import { entity as PerUserNotesChart } from './charts/entities/per-user-notes';
|
import { entity as PerUserNotesChart } from './charts/entities/per-user-notes';
|
||||||
|
@ -10,12 +9,12 @@ import { entity as PerUserReactionsChart } from './charts/entities/per-user-reac
|
||||||
import { entity as HashtagChart } from './charts/entities/hashtag';
|
import { entity as HashtagChart } from './charts/entities/hashtag';
|
||||||
import { entity as PerUserFollowingChart } from './charts/entities/per-user-following';
|
import { entity as PerUserFollowingChart } from './charts/entities/per-user-following';
|
||||||
import { entity as PerUserDriveChart } from './charts/entities/per-user-drive';
|
import { entity as PerUserDriveChart } from './charts/entities/per-user-drive';
|
||||||
|
import { entity as ApRequestChart } from './charts/entities/ap-request';
|
||||||
|
|
||||||
export const entities = [
|
export const entities = [
|
||||||
FederationChart.hour, FederationChart.day,
|
FederationChart.hour, FederationChart.day,
|
||||||
NotesChart.hour, NotesChart.day,
|
NotesChart.hour, NotesChart.day,
|
||||||
UsersChart.hour, UsersChart.day,
|
UsersChart.hour, UsersChart.day,
|
||||||
NetworkChart.hour, NetworkChart.day,
|
|
||||||
ActiveUsersChart.hour, ActiveUsersChart.day,
|
ActiveUsersChart.hour, ActiveUsersChart.day,
|
||||||
InstanceChart.hour, InstanceChart.day,
|
InstanceChart.hour, InstanceChart.day,
|
||||||
PerUserNotesChart.hour, PerUserNotesChart.day,
|
PerUserNotesChart.hour, PerUserNotesChart.day,
|
||||||
|
@ -24,4 +23,5 @@ export const entities = [
|
||||||
HashtagChart.hour, HashtagChart.day,
|
HashtagChart.hour, HashtagChart.day,
|
||||||
PerUserFollowingChart.hour, PerUserFollowingChart.day,
|
PerUserFollowingChart.hour, PerUserFollowingChart.day,
|
||||||
PerUserDriveChart.hour, PerUserDriveChart.day,
|
PerUserDriveChart.hour, PerUserDriveChart.day,
|
||||||
|
ApRequestChart.hour, ApRequestChart.day,
|
||||||
];
|
];
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { beforeShutdown } from '@/misc/before-shutdown';
|
||||||
import FederationChart from './charts/federation';
|
import FederationChart from './charts/federation';
|
||||||
import NotesChart from './charts/notes';
|
import NotesChart from './charts/notes';
|
||||||
import UsersChart from './charts/users';
|
import UsersChart from './charts/users';
|
||||||
import NetworkChart from './charts/network';
|
|
||||||
import ActiveUsersChart from './charts/active-users';
|
import ActiveUsersChart from './charts/active-users';
|
||||||
import InstanceChart from './charts/instance';
|
import InstanceChart from './charts/instance';
|
||||||
import PerUserNotesChart from './charts/per-user-notes';
|
import PerUserNotesChart from './charts/per-user-notes';
|
||||||
|
@ -12,11 +11,11 @@ import PerUserReactionsChart from './charts/per-user-reactions';
|
||||||
import HashtagChart from './charts/hashtag';
|
import HashtagChart from './charts/hashtag';
|
||||||
import PerUserFollowingChart from './charts/per-user-following';
|
import PerUserFollowingChart from './charts/per-user-following';
|
||||||
import PerUserDriveChart from './charts/per-user-drive';
|
import PerUserDriveChart from './charts/per-user-drive';
|
||||||
|
import ApRequestChart from './charts/ap-request';
|
||||||
|
|
||||||
export const federationChart = new FederationChart();
|
export const federationChart = new FederationChart();
|
||||||
export const notesChart = new NotesChart();
|
export const notesChart = new NotesChart();
|
||||||
export const usersChart = new UsersChart();
|
export const usersChart = new UsersChart();
|
||||||
export const networkChart = new NetworkChart();
|
|
||||||
export const activeUsersChart = new ActiveUsersChart();
|
export const activeUsersChart = new ActiveUsersChart();
|
||||||
export const instanceChart = new InstanceChart();
|
export const instanceChart = new InstanceChart();
|
||||||
export const perUserNotesChart = new PerUserNotesChart();
|
export const perUserNotesChart = new PerUserNotesChart();
|
||||||
|
@ -25,12 +24,12 @@ export const perUserReactionsChart = new PerUserReactionsChart();
|
||||||
export const hashtagChart = new HashtagChart();
|
export const hashtagChart = new HashtagChart();
|
||||||
export const perUserFollowingChart = new PerUserFollowingChart();
|
export const perUserFollowingChart = new PerUserFollowingChart();
|
||||||
export const perUserDriveChart = new PerUserDriveChart();
|
export const perUserDriveChart = new PerUserDriveChart();
|
||||||
|
export const apRequestChart = new ApRequestChart();
|
||||||
|
|
||||||
const charts = [
|
const charts = [
|
||||||
federationChart,
|
federationChart,
|
||||||
notesChart,
|
notesChart,
|
||||||
usersChart,
|
usersChart,
|
||||||
networkChart,
|
|
||||||
activeUsersChart,
|
activeUsersChart,
|
||||||
instanceChart,
|
instanceChart,
|
||||||
perUserNotesChart,
|
perUserNotesChart,
|
||||||
|
@ -39,6 +38,7 @@ const charts = [
|
||||||
hashtagChart,
|
hashtagChart,
|
||||||
perUserFollowingChart,
|
perUserFollowingChart,
|
||||||
perUserDriveChart,
|
perUserDriveChart,
|
||||||
|
apRequestChart,
|
||||||
];
|
];
|
||||||
|
|
||||||
// 20分おきにメモリ情報をDBに書き込み
|
// 20分おきにメモリ情報をDBに書き込み
|
||||||
|
|
|
@ -739,13 +739,6 @@
|
||||||
resolved "https://registry.yarnpkg.com/@types/rename/-/rename-1.0.4.tgz#30c6f0306042591a560361ea02639e89647dd173"
|
resolved "https://registry.yarnpkg.com/@types/rename/-/rename-1.0.4.tgz#30c6f0306042591a560361ea02639e89647dd173"
|
||||||
integrity sha512-eV81+6bVv2mdCBahkMefjEUwAjKDAP3AuyhqWCWRxcRaeVdUeHUBaoq2zSz+5HNHF2jzTajMcfLvJsy4K3cbwA==
|
integrity sha512-eV81+6bVv2mdCBahkMefjEUwAjKDAP3AuyhqWCWRxcRaeVdUeHUBaoq2zSz+5HNHF2jzTajMcfLvJsy4K3cbwA==
|
||||||
|
|
||||||
"@types/request-stats@3.0.0":
|
|
||||||
version "3.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/request-stats/-/request-stats-3.0.0.tgz#d3909a9f778b8ae0b42fb8c1ed20cb936ed95f99"
|
|
||||||
integrity sha512-POsDF7nETH8up49iBNvbZuO0pEk9F+TG0rXCkvjxCClcOS99xfF+mKmJteYlwKYpuRKkixzysKlL8rwN1hU2lw==
|
|
||||||
dependencies:
|
|
||||||
"@types/node" "*"
|
|
||||||
|
|
||||||
"@types/responselike@*", "@types/responselike@^1.0.0":
|
"@types/responselike@*", "@types/responselike@^1.0.0":
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/@types/responselike/-/responselike-1.0.0.tgz#251f4fe7d154d2bad125abe1b429b23afd262e29"
|
resolved "https://registry.yarnpkg.com/@types/responselike/-/responselike-1.0.0.tgz#251f4fe7d154d2bad125abe1b429b23afd262e29"
|
||||||
|
@ -3417,13 +3410,6 @@ http-errors@~1.6.2:
|
||||||
setprototypeof "1.1.0"
|
setprototypeof "1.1.0"
|
||||||
statuses ">= 1.4.0 < 2"
|
statuses ">= 1.4.0 < 2"
|
||||||
|
|
||||||
http-headers@^3.0.1:
|
|
||||||
version "3.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/http-headers/-/http-headers-3.0.2.tgz#5147771292f0b39d6778d930a3a59a76fc7ef44d"
|
|
||||||
integrity sha512-87E1I+2Wg4dxxz4rcxElo3dxO/w1ZtgL1yA0Sb6vH3qU16vRKq1NjWQv9SCY3ly2OQROcoxHZOUpmelS+k6wOw==
|
|
||||||
dependencies:
|
|
||||||
next-line "^1.1.0"
|
|
||||||
|
|
||||||
http-proxy-agent@^4.0.1:
|
http-proxy-agent@^4.0.1:
|
||||||
version "4.0.1"
|
version "4.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz#8a8c8ef7f5932ccf953c296ca8291b95aa74aa3a"
|
resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz#8a8c8ef7f5932ccf953c296ca8291b95aa74aa3a"
|
||||||
|
@ -4865,11 +4851,6 @@ netmask@^2.0.2:
|
||||||
resolved "https://registry.yarnpkg.com/netmask/-/netmask-2.0.2.tgz#8b01a07644065d536383835823bc52004ebac5e7"
|
resolved "https://registry.yarnpkg.com/netmask/-/netmask-2.0.2.tgz#8b01a07644065d536383835823bc52004ebac5e7"
|
||||||
integrity sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==
|
integrity sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==
|
||||||
|
|
||||||
next-line@^1.1.0:
|
|
||||||
version "1.1.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/next-line/-/next-line-1.1.0.tgz#fcae57853052b6a9bae8208e40dd7d3c2d304603"
|
|
||||||
integrity sha1-/K5XhTBStqm66CCOQN19PC0wRgM=
|
|
||||||
|
|
||||||
next-tick@~1.0.0:
|
next-tick@~1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c"
|
resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c"
|
||||||
|
@ -5907,14 +5888,6 @@ rename@1.0.4:
|
||||||
dependencies:
|
dependencies:
|
||||||
debug "^2.5.2"
|
debug "^2.5.2"
|
||||||
|
|
||||||
request-stats@3.0.0:
|
|
||||||
version "3.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/request-stats/-/request-stats-3.0.0.tgz#769155dc8974d78d4a1cb87bbf14eaab985afe25"
|
|
||||||
integrity sha1-dpFV3Il0141KHLh7vxTqq5ha/iU=
|
|
||||||
dependencies:
|
|
||||||
http-headers "^3.0.1"
|
|
||||||
once "^1.4.0"
|
|
||||||
|
|
||||||
require-all@3.0.0:
|
require-all@3.0.0:
|
||||||
version "3.0.0"
|
version "3.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/require-all/-/require-all-3.0.0.tgz#473d49704be310115ce124f77383b1ebd8671312"
|
resolved "https://registry.yarnpkg.com/require-all/-/require-all-3.0.0.tgz#473d49704be310115ce124f77383b1ebd8671312"
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
"@types/punycode": "2.1.0",
|
"@types/punycode": "2.1.0",
|
||||||
"@types/qrcode": "1.4.2",
|
"@types/qrcode": "1.4.2",
|
||||||
"@types/random-seed": "0.3.3",
|
"@types/random-seed": "0.3.3",
|
||||||
"@types/request-stats": "3.0.0",
|
|
||||||
"@types/seedrandom": "2.4.28",
|
"@types/seedrandom": "2.4.28",
|
||||||
"@types/throttle-debounce": "2.1.0",
|
"@types/throttle-debounce": "2.1.0",
|
||||||
"@types/tinycolor2": "1.4.3",
|
"@types/tinycolor2": "1.4.3",
|
||||||
|
@ -86,7 +85,6 @@
|
||||||
"querystring": "0.2.1",
|
"querystring": "0.2.1",
|
||||||
"random-seed": "0.3.0",
|
"random-seed": "0.3.0",
|
||||||
"reflect-metadata": "0.1.13",
|
"reflect-metadata": "0.1.13",
|
||||||
"request-stats": "3.0.0",
|
|
||||||
"rndstr": "1.0.0",
|
"rndstr": "1.0.0",
|
||||||
"s-age": "1.1.2",
|
"s-age": "1.1.2",
|
||||||
"sass": "1.49.0",
|
"sass": "1.49.0",
|
||||||
|
|
|
@ -455,13 +455,6 @@
|
||||||
resolved "https://registry.yarnpkg.com/@types/random-seed/-/random-seed-0.3.3.tgz#7741f7b0a4513198a9396ce4ad25832f799a6727"
|
resolved "https://registry.yarnpkg.com/@types/random-seed/-/random-seed-0.3.3.tgz#7741f7b0a4513198a9396ce4ad25832f799a6727"
|
||||||
integrity sha512-kHsCbIRHNXJo6EN5W8EA5b4i1hdT6jaZke5crBPLUcLqaLdZ0QBq8QVMbafHzhjFF83Cl9qlee2dChD18d/kPg==
|
integrity sha512-kHsCbIRHNXJo6EN5W8EA5b4i1hdT6jaZke5crBPLUcLqaLdZ0QBq8QVMbafHzhjFF83Cl9qlee2dChD18d/kPg==
|
||||||
|
|
||||||
"@types/request-stats@3.0.0":
|
|
||||||
version "3.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/request-stats/-/request-stats-3.0.0.tgz#d3909a9f778b8ae0b42fb8c1ed20cb936ed95f99"
|
|
||||||
integrity sha512-POsDF7nETH8up49iBNvbZuO0pEk9F+TG0rXCkvjxCClcOS99xfF+mKmJteYlwKYpuRKkixzysKlL8rwN1hU2lw==
|
|
||||||
dependencies:
|
|
||||||
"@types/node" "*"
|
|
||||||
|
|
||||||
"@types/seedrandom@2.4.28":
|
"@types/seedrandom@2.4.28":
|
||||||
version "2.4.28"
|
version "2.4.28"
|
||||||
resolved "https://registry.yarnpkg.com/@types/seedrandom/-/seedrandom-2.4.28.tgz#9ce8fa048c1e8c85cb71d7fe4d704e000226036f"
|
resolved "https://registry.yarnpkg.com/@types/seedrandom/-/seedrandom-2.4.28.tgz#9ce8fa048c1e8c85cb71d7fe4d704e000226036f"
|
||||||
|
@ -3219,13 +3212,6 @@ homedir-polyfill@^1.0.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
parse-passwd "^1.0.0"
|
parse-passwd "^1.0.0"
|
||||||
|
|
||||||
http-headers@^3.0.1:
|
|
||||||
version "3.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/http-headers/-/http-headers-3.0.2.tgz#5147771292f0b39d6778d930a3a59a76fc7ef44d"
|
|
||||||
integrity sha512-87E1I+2Wg4dxxz4rcxElo3dxO/w1ZtgL1yA0Sb6vH3qU16vRKq1NjWQv9SCY3ly2OQROcoxHZOUpmelS+k6wOw==
|
|
||||||
dependencies:
|
|
||||||
next-line "^1.1.0"
|
|
||||||
|
|
||||||
http-signature@~1.3.6:
|
http-signature@~1.3.6:
|
||||||
version "1.3.6"
|
version "1.3.6"
|
||||||
resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.3.6.tgz#cb6fbfdf86d1c974f343be94e87f7fc128662cf9"
|
resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.3.6.tgz#cb6fbfdf86d1c974f343be94e87f7fc128662cf9"
|
||||||
|
@ -4243,11 +4229,6 @@ netmask@^2.0.2:
|
||||||
resolved "https://registry.yarnpkg.com/netmask/-/netmask-2.0.2.tgz#8b01a07644065d536383835823bc52004ebac5e7"
|
resolved "https://registry.yarnpkg.com/netmask/-/netmask-2.0.2.tgz#8b01a07644065d536383835823bc52004ebac5e7"
|
||||||
integrity sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==
|
integrity sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==
|
||||||
|
|
||||||
next-line@^1.1.0:
|
|
||||||
version "1.1.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/next-line/-/next-line-1.1.0.tgz#fcae57853052b6a9bae8208e40dd7d3c2d304603"
|
|
||||||
integrity sha1-/K5XhTBStqm66CCOQN19PC0wRgM=
|
|
||||||
|
|
||||||
next-tick@~1.0.0:
|
next-tick@~1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c"
|
resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c"
|
||||||
|
@ -5172,14 +5153,6 @@ request-progress@^3.0.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
throttleit "^1.0.0"
|
throttleit "^1.0.0"
|
||||||
|
|
||||||
request-stats@3.0.0:
|
|
||||||
version "3.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/request-stats/-/request-stats-3.0.0.tgz#769155dc8974d78d4a1cb87bbf14eaab985afe25"
|
|
||||||
integrity sha1-dpFV3Il0141KHLh7vxTqq5ha/iU=
|
|
||||||
dependencies:
|
|
||||||
http-headers "^3.0.1"
|
|
||||||
once "^1.4.0"
|
|
||||||
|
|
||||||
require-directory@^2.1.1:
|
require-directory@^2.1.1:
|
||||||
version "2.1.1"
|
version "2.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42"
|
resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42"
|
||||||
|
|
Loading…
Reference in New Issue