overleaf/services/web/migrations/20240923131936_create_user_last_active_index.js
Miguel Serrano 3ff142d478 [web] Expose metric for active users in SP (#20130)
* [web] Expose metric for active users in SP

* Removed redundant UserHandler.setupLoginData()

In the past this method was also calling
a now deleted notifyDomainLicence(), but now
this is just an alias for populateTeamInvites()

* Added migration for `lastActive`

* Added secondary read precedence to count active users

GitOrigin-RevId: 86d6db31e1ae74ae40c6599e6acb731d8c4a04bd
2024-10-14 10:57:28 +00:00

20 lines
423 B
JavaScript

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