obs-portal/old-api/migrations/2020-12-12-1823-original-filename.js
2021-11-22 09:50:33 +01:00

22 lines
382 B
JavaScript

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();
},
};