]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/initializers/migrations/0080-video-channels.ts
Add ability for auth plugins to hook tokens validity
[github/Chocobozzz/PeerTube.git] / server / initializers / migrations / 0080-video-channels.ts
index f197215176c14d876b0767e1f7887f4424933f4d..883224cb02e929a78766b56c197b26e2cfa23dcf 100644 (file)
@@ -1,10 +1,10 @@
 import * as Sequelize from 'sequelize'
-import * as uuidv4 from 'uuid/v4'
+import { v4 as uuidv4 } from 'uuid'
 
 async function up (utils: {
-  transaction: Sequelize.Transaction,
-  queryInterface: Sequelize.QueryInterface,
-  sequelize: Sequelize.Sequelize,
+  transaction: Sequelize.Transaction
+  queryInterface: Sequelize.QueryInterface
+  sequelize: Sequelize.Sequelize
   db: any
 }): Promise<void> {
   const q = utils.queryInterface
@@ -69,12 +69,12 @@ async function up (utils: {
   const options = {
     type: Sequelize.QueryTypes.SELECT
   }
-  const rawVideos = await utils.sequelize.query(query, options)
+  const rawVideos = await utils.sequelize.query(query, options) as any
 
   for (const rawVideo of rawVideos) {
     const videoChannel = await utils.db.VideoChannel.findOne({ where: { authorId: rawVideo.authorId } })
 
-    const video = await utils.db.Video.findById(rawVideo.id)
+    const video = await utils.db.Video.findByPk(rawVideo.id)
     video.channelId = videoChannel.id
     await video.save()
   }