1 import * as Sequelize from 'sequelize'
3 async function up (utils: {
4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize
11 type: Sequelize.INTEGER,
14 model: 'videoStreamingPlaylist',
20 await utils.queryInterface.addColumn('videoFile', 'videoStreamingPlaylistId', data)
25 type: Sequelize.INTEGER,
29 await utils.queryInterface.changeColumn('videoFile', 'videoId', data)
33 await utils.queryInterface.removeIndex('videoFile', 'video_file_video_id_resolution_fps')
37 const query = 'insert into "videoFile" ' +
38 '(resolution, size, "infoHash", "videoId", "createdAt", "updatedAt", fps, extname, "videoStreamingPlaylistId")' +
39 '(SELECT "videoFile".resolution, "videoFile".size, \'fake\', NULL, "videoFile"."createdAt", "videoFile"."updatedAt", ' +
40 '"videoFile"."fps", "videoFile".extname, "videoStreamingPlaylist".id FROM "videoStreamingPlaylist" ' +
41 'inner join video ON video.id = "videoStreamingPlaylist"."videoId" inner join "videoFile" ON "videoFile"."videoId" = video.id)'
43 await utils.sequelize.query(query, { transaction: utils.transaction })
47 function down (options) {
48 throw new Error('Not implemented.')