blob: 5964b0dc5ea34d6c4ab993b0aed913947e14cb1e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
import * as Sequelize from 'sequelize'
async function up (utils: {
transaction: Sequelize.Transaction
queryInterface: Sequelize.QueryInterface
sequelize: Sequelize.Sequelize
}): Promise<any> {
await utils.sequelize.query('DROP INDEX IF EXISTS video_id_privacy_state_wait_transcoding;')
await utils.sequelize.query('DROP INDEX IF EXISTS video_name;')
for (let i = 0; i < 5; i++) {
const query = 'DELETE FROM "videoFile" WHERE id IN ' +
'(SELECT id FROM (SELECT MIN(id) AS id, "videoId", "resolution", "fps" ' +
'FROM "videoFile" GROUP BY "videoId", "resolution", "fps" HAVING COUNT(*) > 1) t)'
await utils.sequelize.query(query)
}
for (let i = 0; i < 5; i++) {
const query = 'DELETE FROM "actor" WHERE id IN ' +
'(SELECT id FROM (SELECT MIN(id) AS id, "uuid" ' +
'FROM "actor" GROUP BY "uuid" HAVING COUNT(*) > 1) t)'
await utils.sequelize.query(query)
}
for (let i = 0; i < 5; i++) {
const query = 'DELETE FROM "account" WHERE id IN ' +
'(SELECT id FROM (SELECT MIN(id) AS id, "actorId" ' +
'FROM "account" GROUP BY "actorId" HAVING COUNT(*) > 1) t)'
await utils.sequelize.query(query)
}
}
function down (options) {
throw new Error('Not implemented.')
}
export { up, down }
|