20230426095212_personal_oauth_tokens_user_index.mjs 535 B

123456789101112131415161718192021222324252627
  1. import Helpers from './lib/helpers.mjs'
  2. const tags = ['server-ce', 'server-pro', 'saas']
  3. const indexes = [
  4. {
  5. key: { user_id: 1 },
  6. name: 'pat_user_id_1',
  7. partialFilterExpression: { type: 'pat' },
  8. },
  9. ]
  10. const migrate = async client => {
  11. const { db } = client
  12. await Helpers.addIndexesToCollection(db.oauthAccessTokens, indexes)
  13. }
  14. const rollback = async client => {
  15. const { db } = client
  16. await Helpers.dropIndexesFromCollection(db.oauthAccessTokens, indexes)
  17. }
  18. export default {
  19. tags,
  20. migrate,
  21. rollback,
  22. }