delete needless instance drive columns

This commit is contained in:
syuilo 2022-03-07 21:20:14 +09:00
parent ec64b5ea0b
commit 513c83e374
7 changed files with 13 additions and 30 deletions

View file

@ -0,0 +1,13 @@
export class removeInstanceDriveColumns1646655454495 {
name = 'removeInstanceDriveColumns1646655454495'
async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "driveUsage"`);
await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "driveFiles"`);
}
async down(queryRunner) {
await queryRunner.query(`ALTER TABLE "instance" ADD "driveFiles" integer NOT NULL DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE "instance" ADD "driveUsage" bigint NOT NULL DEFAULT '0'`);
}
}

View file

@ -59,22 +59,6 @@ export class Instance {
}) })
public followersCount: number; public followersCount: number;
/**
* 使
*/
@Column('bigint', {
default: 0,
})
public driveUsage: number;
/**
*
*/
@Column('integer', {
default: 0,
})
public driveFiles: number;
/** /**
* *
*/ */

View file

@ -55,10 +55,6 @@ export default define(meta, paramDef, async (ps, me) => {
case '-caughtAt': query.orderBy('instance.caughtAt', 'ASC'); break; case '-caughtAt': query.orderBy('instance.caughtAt', 'ASC'); break;
case '+lastCommunicatedAt': query.orderBy('instance.lastCommunicatedAt', 'DESC'); break; case '+lastCommunicatedAt': query.orderBy('instance.lastCommunicatedAt', 'DESC'); break;
case '-lastCommunicatedAt': query.orderBy('instance.lastCommunicatedAt', 'ASC'); break; case '-lastCommunicatedAt': query.orderBy('instance.lastCommunicatedAt', 'ASC'); break;
case '+driveUsage': query.orderBy('instance.driveUsage', 'DESC'); break;
case '-driveUsage': query.orderBy('instance.driveUsage', 'ASC'); break;
case '+driveFiles': query.orderBy('instance.driveFiles', 'DESC'); break;
case '-driveFiles': query.orderBy('instance.driveFiles', 'ASC'); break;
default: query.orderBy('instance.id', 'DESC'); break; default: query.orderBy('instance.id', 'DESC'); break;
} }

View file

@ -21,14 +21,12 @@ export default class InstanceChart extends Chart<typeof schema> {
followingCount, followingCount,
followersCount, followersCount,
driveFiles, driveFiles,
//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),
]); ]);
return { return {

View file

@ -484,8 +484,6 @@ export async function addFile({
perUserDriveChart.update(file, true); perUserDriveChart.update(file, true);
if (file.userHost !== null) { if (file.userHost !== null) {
instanceChart.updateDrive(file, true); instanceChart.updateDrive(file, true);
Instances.increment({ host: file.userHost }, 'driveUsage', file.size);
Instances.increment({ host: file.userHost }, 'driveFiles', 1);
} }
return file; return file;

View file

@ -86,8 +86,6 @@ async function postProcess(file: DriveFile, isExpired = false) {
perUserDriveChart.update(file, false); perUserDriveChart.update(file, false);
if (file.userHost !== null) { if (file.userHost !== null) {
instanceChart.updateDrive(file, false); instanceChart.updateDrive(file, false);
Instances.decrement({ host: file.userHost }, 'driveUsage', file.size);
Instances.decrement({ host: file.userHost }, 'driveFiles', 1);
} }
} }

View file

@ -33,10 +33,6 @@
<option value="-caughtAt">{{ $ts.registeredAt }} ({{ $ts.ascendingOrder }})</option> <option value="-caughtAt">{{ $ts.registeredAt }} ({{ $ts.ascendingOrder }})</option>
<option value="+lastCommunicatedAt">{{ $ts.lastCommunication }} ({{ $ts.descendingOrder }})</option> <option value="+lastCommunicatedAt">{{ $ts.lastCommunication }} ({{ $ts.descendingOrder }})</option>
<option value="-lastCommunicatedAt">{{ $ts.lastCommunication }} ({{ $ts.ascendingOrder }})</option> <option value="-lastCommunicatedAt">{{ $ts.lastCommunication }} ({{ $ts.ascendingOrder }})</option>
<option value="+driveUsage">{{ $ts.driveUsage }} ({{ $ts.descendingOrder }})</option>
<option value="-driveUsage">{{ $ts.driveUsage }} ({{ $ts.ascendingOrder }})</option>
<option value="+driveFiles">{{ $ts.driveFilesCount }} ({{ $ts.descendingOrder }})</option>
<option value="-driveFiles">{{ $ts.driveFilesCount }} ({{ $ts.ascendingOrder }})</option>
</MkSelect> </MkSelect>
</FormSplit> </FormSplit>
</div> </div>