Merge pull request #10644 from overleaf/em-chunk-store-mongo

Mongo backend for the history chunk store

GitOrigin-RevId: 8dcfc7e62065785616b7894009368b6acbb4428a
This commit is contained in:
Eric Mc Sween 2022-11-28 10:05:30 -05:00 committed by Copybot
parent 4589a57774
commit 3efcd3e52b
2 changed files with 28 additions and 0 deletions

View file

@ -61,6 +61,7 @@ async function setupDb() {
db.oauthApplications = internalDb.collection('oauthApplications') db.oauthApplications = internalDb.collection('oauthApplications')
db.oauthAuthorizationCodes = internalDb.collection('oauthAuthorizationCodes') db.oauthAuthorizationCodes = internalDb.collection('oauthAuthorizationCodes')
db.projectAuditLogEntries = internalDb.collection('projectAuditLogEntries') db.projectAuditLogEntries = internalDb.collection('projectAuditLogEntries')
db.projectHistoryChunks = internalDb.collection('projectHistoryChunks')
db.projectHistoryFailures = internalDb.collection('projectHistoryFailures') db.projectHistoryFailures = internalDb.collection('projectHistoryFailures')
db.projectHistoryLabels = internalDb.collection('projectHistoryLabels') db.projectHistoryLabels = internalDb.collection('projectHistoryLabels')
db.projectHistoryMetaData = internalDb.collection('projectHistoryMetaData') db.projectHistoryMetaData = internalDb.collection('projectHistoryMetaData')

View file

@ -0,0 +1,27 @@
/* eslint-disable no-unused-vars */
const Helpers = require('./lib/helpers')
exports.tags = ['server-ce', 'server-pro', 'saas']
const indexes = [
{
key: { projectId: 1, startVersion: 1 },
name: 'projectId_1_startVersion_1',
partialFilterExpression: { state: 'active' },
unique: true,
},
{
key: { state: 1 },
name: 'state_1',
partialFilterExpression: { state: 'deleted' },
},
]
exports.migrate = async ({ db }) => {
await Helpers.addIndexesToCollection(db.projectHistoryChunks, indexes)
}
exports.rollback = async ({ db }) => {
await Helpers.dropIndexesFromCollection(db.projectHistoryChunks, indexes)
}