1 import * as Sequelize from 'sequelize'
2 import { createClient } from 'redis'
3 import { CONFIG } from '../constants'
4 import { JobQueue } from '../../lib/job-queue'
5 import { initDatabaseModels } from '../database'
7 async function up (utils: {
8 transaction: Sequelize.Transaction
9 queryInterface: Sequelize.QueryInterface
10 sequelize: Sequelize.Sequelize
14 'accounts_application_id',
18 'account_video_rates_video_id_account_id',
19 'account_video_rates_video_id_account_id_type',
21 'account_follows_account_id_target_account_id',
22 'account_follow_account_id_target_account_id',
23 'account_follow_account_id',
24 'account_follow_target_account_id',
25 'account_follows_account_id',
26 'account_follows_target_account_id',
28 'o_auth_clients_client_id',
29 'o_auth_clients_client_id_client_secret',
31 'o_auth_tokens_access_token',
32 'o_auth_tokens_refresh_token',
33 'o_auth_tokens_o_auth_client_id',
34 'o_auth_tokens_user_id',
52 'video_abuses_reporter_account_id',
53 'video_abuses_video_id',
55 'blacklisted_videos_video_id',
57 'video_channels_account_id',
59 'video_files_info_hash',
60 'video_files_video_id',
62 'video_shares_account_id',
63 'video_shares_video_id',
69 for (const indexName of indexNames) {
70 await utils.sequelize.query('DROP INDEX IF EXISTS "' + indexName + '";')
73 await utils.sequelize.query('ALTER TABLE "account" DROP CONSTRAINT IF EXISTS "actorId_foreign_idx";')
74 await utils.sequelize.query('ALTER TABLE "videoChannel" DROP CONSTRAINT IF EXISTS "actorId_foreign_idx";')
75 await utils.sequelize.query('ALTER TABLE "videoShare" DROP CONSTRAINT IF EXISTS "VideoShares_videoId_fkey";')
77 await utils.sequelize.query('DROP TABLE IF EXISTS "videoChannelShare";')
80 function down (options) {
81 throw new Error('Not implemented.')