20250403133427_create_index_for_script_logs.mjs 552 B

1234567891011121314151617181920212223242526272829303132
  1. /* eslint-disable no-unused-vars */
  2. import Helpers from './lib/helpers.mjs'
  3. const tags = ['saas']
  4. const indexes = [
  5. {
  6. key: { canonicalName: 1 },
  7. name: 'canonicalName_1',
  8. },
  9. {
  10. key: { username: 1 },
  11. name: 'username_1',
  12. },
  13. ]
  14. const migrate = async client => {
  15. const { db } = client
  16. await Helpers.addIndexesToCollection(db.scriptLogs, indexes)
  17. }
  18. const rollback = async client => {
  19. const { db } = client
  20. await Helpers.dropIndexesFromCollection(db.scriptLogs, indexes)
  21. }
  22. export default {
  23. tags,
  24. migrate,
  25. rollback,
  26. }