obs-portal/migrations/2020-12-13-2025-move-to-upload-file.js
2021-01-19 16:37:01 +01:00

26 lines
417 B
JavaScript

const Track = require('../src/models/Track');
module.exports = {
async up(next) {
try {
for await (const track of Track.find()) {
if (!track.body) {
continue
}
await track.writeToOriginalFile(track.body)
delete track.body;
await track.save()
}
next();
} catch(err) {
next(err)
}
},
async down(next) {
next();
},
};