obs-portal/migrations/2020-12-12-1823-original-filename.js

22 lines
382 B
JavaScript
Raw Normal View History

2020-12-13 19:45:26 +00:00
const Track = require('../src/models/Track');
module.exports = {
async up(next) {
try {
for await (const track of Track.find()) {
track.originalFileName = track.slug + '.csv'
await track.generateOriginalFilePath();
await track.save()
}
next();
} catch(err) {
next(err)
}
},
async down(next) {
next();
},
};