overleaf/services/web/migrations/20230426095212_personal_oauth_tokens_user_index.js

22 lines
491 B
JavaScript
Raw Normal View History

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)
}