Skip to content

Commit

Permalink
update for umzug
Browse files Browse the repository at this point in the history
  • Loading branch information
goto-bus-stop committed Feb 10, 2021
1 parent 3b4e3e3 commit c7e93e1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/migrations/001-activePlaylistState.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { ObjectId } = require('mongoose').mongo;
const { zip } = require('lodash');

exports.up = async function up(uw) {
async function up({ context: uw }) {
const { User } = uw.models;

const ops = [];
Expand All @@ -21,9 +21,9 @@ exports.up = async function up(uw) {
}

await User.bulkWrite(ops);
};
}

exports.down = async function down(uw) {
async function down({ context: uw }) {
const { User } = uw.models;

const users = User.find({ activePlaylist: { $ne: null } });
Expand All @@ -33,4 +33,6 @@ exports.down = async function down(uw) {

await uw.redis.set(`playlist:${user.id}`, user.activePlaylist.toString());
}
};
}

module.exports = { up, down };

0 comments on commit c7e93e1

Please sign in to comment.