overleaf/services/web/migrations/20210924140139_splittests-name-index.js
Alexandre Bourdin 07e5d1ba90 Merge pull request #5229 from overleaf/ab-splittest-name-index
Add migration to create unique index on splittests name

GitOrigin-RevId: d7420ad714a09abedafb7462b51b3c403c9a026b
2021-10-01 08:03:19 +00:00

23 lines
417 B
JavaScript

const Helpers = require('./lib/helpers')
exports.tags = ['saas']
const indexes = [
{
key: {
name: 1,
},
unique: true,
name: 'name_1',
},
]
exports.migrate = async client => {
const { db } = client
await Helpers.addIndexesToCollection(db.splittests, indexes)
}
exports.rollback = async client => {
const { db } = client
Helpers.dropIndexesFromCollection(db.splittests, indexes)
}