2 Change video magnet structures
5 const each = require('async/each')
6 const mongoose = require('mongoose')
8 const Video = mongoose.model('Video')
10 exports.up = function (callback) {
11 // Use of lean because the new Video scheme does not have podUrl field
12 Video.find({ }).lean().exec(function (err, videos) {
15 each(videos, function (video, callbackEach) {
16 Video.load(video._id, function (err, videoObj) {
17 if (err) return callbackEach(err)
19 const host = video.podUrl.split('://')[1]
21 videoObj.podHost = host
22 videoObj.save(callbackEach)
28 exports.down = function (callback) {
29 throw new Error('Not implemented.')