migration24.js 680 B

12345678910111213141516171819202122232425262728
  1. /**
  2. * Migration 24
  3. *
  4. * Migration for setting station skip vote threshold
  5. *
  6. * @param {object} MigrationModule - the MigrationModule
  7. * @returns {Promise} - returns promise
  8. */
  9. export default async function migrate(MigrationModule) {
  10. const stationModel = await MigrationModule.runJob("GET_MODEL", { modelName: "station" }, this);
  11. return new Promise((resolve, reject) => {
  12. this.log("INFO", `Migration 24. Updating stations with document version 8.`);
  13. stationModel.updateMany(
  14. { documentVersion: 8 },
  15. {
  16. $set: {
  17. documentVersion: 9,
  18. skipVoteThreshold: 100
  19. }
  20. },
  21. err => {
  22. if (err) reject(new Error(err));
  23. else resolve();
  24. }
  25. );
  26. });
  27. }