20220105130000_fix_saml_indexes.mjs 794 B

12345678910111213141516171819202122232425262728
  1. import Helpers from './lib/helpers.mjs'
  2. import SamlLogsIndexesMigration from './20191106102104_saml-log-indexes.mjs'
  3. import SamlIndentifiersIndexMigration from './20191107191318_saml-indentifiers-index.mjs'
  4. const { samlLogsIndexes } = SamlLogsIndexesMigration
  5. const { usersIndexes } = SamlIndentifiersIndexMigration
  6. const tags = ['saas']
  7. const migrate = async ({ db }) => {
  8. // Fix-up the previous SAML migrations that were operating on collections with
  9. // typos in their names.
  10. await Helpers.addIndexesToCollection(
  11. db.users,
  12. usersIndexes.map(index => {
  13. return Object.assign({}, index, { unique: true })
  14. })
  15. )
  16. await Helpers.addIndexesToCollection(db.samlLogs, samlLogsIndexes)
  17. }
  18. const rollback = async () => {}
  19. export default {
  20. tags,
  21. migrate,
  22. rollback,
  23. }