overleaf/services/web/migrations/20230426095212_personal_oauth_tokens_user_index.js
Miguel Serrano d2172e5179 [web] Issue Oauth2 access tokens (#12788)
* [web] Issue Oauth2 access tokens

* [web] Add partial index for `oauthAccessTokens.user_id` for Personal Access Tokens

* [web] script to create personal access tokens

GitOrigin-RevId: 796e8d23a6799a87ac6096c686139c6290668b83
2023-04-28 08:04:10 +00:00

21 lines
491 B
JavaScript

const Helpers = require('./lib/helpers')
exports.tags = ['server-ce', 'server-pro', 'saas']
const indexes = [
{
key: { user_id: 1 },
name: 'pat_user_id_1',
partialFilterExpression: { type: 'pat' },
},
]
exports.migrate = async client => {
const { db } = client
await Helpers.addIndexesToCollection(db.oauthAccessTokens, indexes)
}
exports.rollback = async client => {
const { db } = client
await Helpers.dropIndexesFromCollection(db.oauthAccessTokens, indexes)
}