20190912145018_create_projectHistoryFailures_indexes.mjs 658 B

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