From 439b1744f5f50b8530cded9398d51aa4bb5ed4ff Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 20 Dec 2018 15:25:24 +0100 Subject: Optimize index sizes --- .../migrations/0310-drop-unused-video-indexes.ts | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 server/initializers/migrations/0310-drop-unused-video-indexes.ts (limited to 'server/initializers/migrations/0310-drop-unused-video-indexes.ts') diff --git a/server/initializers/migrations/0310-drop-unused-video-indexes.ts b/server/initializers/migrations/0310-drop-unused-video-indexes.ts new file mode 100644 index 000000000..d51f430c0 --- /dev/null +++ b/server/initializers/migrations/0310-drop-unused-video-indexes.ts @@ -0,0 +1,32 @@ +import * as Sequelize from 'sequelize' + +async function up (utils: { + transaction: Sequelize.Transaction, + queryInterface: Sequelize.QueryInterface, + sequelize: Sequelize.Sequelize, + db: any +}): Promise { + const indexNames = [ + 'video_category', + 'video_licence', + 'video_nsfw', + 'video_language', + 'video_wait_transcoding', + 'video_state', + 'video_remote', + 'video_likes' + ] + + for (const indexName of indexNames) { + await utils.sequelize.query('DROP INDEX IF EXISTS "' + indexName + '";') + } +} + +function down (options) { + throw new Error('Not implemented.') +} + +export { + up, + down +} -- cgit v1.2.3