20190912145010_create_githubSyncProjectStates_indexes.js 659 B

123456789101112131415161718192021222324252627282930313233343536
  1. /* eslint-disable no-unused-vars */
  2. const Helpers = require('./lib/helpers')
  3. exports.tags = ['saas']
  4. const indexes = [
  5. {
  6. key: {
  7. project_id: 1,
  8. },
  9. name: 'project_id_1',
  10. },
  11. {
  12. key: {
  13. owner_id: 1,
  14. },
  15. name: 'owner_id_1',
  16. },
  17. ]
  18. exports.migrate = async client => {
  19. const { db } = client
  20. await Helpers.addIndexesToCollection(db.githubSyncProjectStates, indexes)
  21. }
  22. exports.rollback = async client => {
  23. const { db } = client
  24. try {
  25. await Helpers.dropIndexesFromCollection(db.githubSyncProjectStates, indexes)
  26. } catch (err) {
  27. console.error('Something went wrong rolling back the migrations', err)
  28. }
  29. }