20231113173237_tokens_user_id_index.mjs 504 B

12345678910111213141516171819202122232425262728
  1. /* eslint-disable no-unused-vars */
  2. import Helpers from './lib/helpers.mjs'
  3. const tags = ['server-ce', 'server-pro', 'saas']
  4. const index = {
  5. key: {
  6. 'data.user_id': 1,
  7. },
  8. name: 'data.user_id_1',
  9. }
  10. const migrate = async client => {
  11. const { db } = client
  12. await Helpers.addIndexesToCollection(db.tokens, [index])
  13. }
  14. const rollback = async client => {
  15. const { db } = client
  16. await Helpers.dropIndexesFromCollection(db.tokens, [index])
  17. }
  18. export default {
  19. tags,
  20. migrate,
  21. rollback,
  22. }