]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/initializers/migrations/0080-video-channels.ts
Move uuid stuff in extra utils
[github/Chocobozzz/PeerTube.git] / server / initializers / migrations / 0080-video-channels.ts
index 0e17a4ccde72937b3b4d93eb25401435d65ff527..ef3e15968ca012373762d2f24c1f9bc105dede6f 100644 (file)
@@ -1,10 +1,10 @@
+import { buildUUID } from '@shared/extra-utils'
 import * as Sequelize from 'sequelize'
-import * as uuidv4 from 'uuid/v4'
 
 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
@@ -23,7 +23,7 @@ async function up (utils: {
   {
     const authors = await utils.db.Author.findAll()
     for (const author of authors) {
-      author.uuid = uuidv4()
+      author.uuid = buildUUID()
       await author.save()
     }
   }
@@ -69,7 +69,7 @@ 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 } })