From 6fd8c4da261ce12aeaa2a4d75e8eec1a43592784 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 10 Jan 2020 10:41:05 +0100 Subject: [PATCH] Cleanup DB indexes --- server/initializers/constants.ts | 2 +- .../migrations/0470-cleaup-indexes.ts | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 server/initializers/migrations/0470-cleaup-indexes.ts diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 8461c7320..d4ac8bbbe 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts @@ -14,7 +14,7 @@ import { CONFIG, registerConfigChangedHandler } from './config' // --------------------------------------------------------------------------- -const LAST_MIGRATION_VERSION = 465 +const LAST_MIGRATION_VERSION = 470 // --------------------------------------------------------------------------- diff --git a/server/initializers/migrations/0470-cleaup-indexes.ts b/server/initializers/migrations/0470-cleaup-indexes.ts new file mode 100644 index 000000000..53e401c2b --- /dev/null +++ b/server/initializers/migrations/0470-cleaup-indexes.ts @@ -0,0 +1,22 @@ +import * as Sequelize from 'sequelize' + +async function up (utils: { + transaction: Sequelize.Transaction, + queryInterface: Sequelize.QueryInterface, + sequelize: Sequelize.Sequelize, + db: any +}): Promise { + await utils.sequelize.query('DROP INDEX IF EXISTS video_share_account_id;') + await utils.sequelize.query('DROP INDEX IF EXISTS video_published_at;') + + await utils.sequelize.query('ALTER TABLE "avatar" DROP COLUMN IF EXISTS "avatarId"') +} + +function down (options) { + throw new Error('Not implemented.') +} + +export { + up, + down +} -- 2.25.1