summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2020-02-15 04:29:57 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2020-02-15 04:29:57 +0900
commit5ccd5ad56e0cd013deb5f73de26aa3d298deec77 (patch)
treee62d271c126037495b6db745d510304a60aafa78
parentUse em (diff)
downloadsharkey-5ccd5ad56e0cd013deb5f73de26aa3d298deec77.tar.gz
sharkey-5ccd5ad56e0cd013deb5f73de26aa3d298deec77.tar.bz2
sharkey-5ccd5ad56e0cd013deb5f73de26aa3d298deec77.zip
Add driveFiles index
-rw-r--r--CHANGELOG.md1
-rw-r--r--migration/1581708415836-drive-user-folder-id-index.ts14
-rw-r--r--src/models/entities/drive-file.ts1
3 files changed, 16 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b53eaf93cf..f3856b14a3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,7 @@ unreleased
### 🐛Fixes
* v12アップデート後にトップページアクセスでOops!になっちゃうのを修正
+* drive/files APIのパフォーマンスを改善
12.9.0 (2020/02/14)
-------------------
diff --git a/migration/1581708415836-drive-user-folder-id-index.ts b/migration/1581708415836-drive-user-folder-id-index.ts
new file mode 100644
index 0000000000..e7a7628ff0
--- /dev/null
+++ b/migration/1581708415836-drive-user-folder-id-index.ts
@@ -0,0 +1,14 @@
+import {MigrationInterface, QueryRunner} from "typeorm";
+
+export class driveUserFolderIdIndex1581708415836 implements MigrationInterface {
+ name = 'driveUserFolderIdIndex1581708415836'
+
+ public async up(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.query(`CREATE INDEX "IDX_55720b33a61a7c806a8215b825" ON "drive_file" ("userId", "folderId", "id") `, undefined);
+ }
+
+ public async down(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.query(`DROP INDEX "IDX_55720b33a61a7c806a8215b825"`, undefined);
+ }
+
+}
diff --git a/src/models/entities/drive-file.ts b/src/models/entities/drive-file.ts
index 319bdc82ce..067dc1181c 100644
--- a/src/models/entities/drive-file.ts
+++ b/src/models/entities/drive-file.ts
@@ -4,6 +4,7 @@ import { DriveFolder } from './drive-folder';
import { id } from '../id';
@Entity()
+@Index(['userId', 'folderId', 'id'])
export class DriveFile {
@PrimaryColumn(id())
public id: string;