migration24.js 677 B

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