20190912145016_create_oauthApplications_indexes.js 579 B

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