mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
[migrations] open source newly added indexes (#870)
This commit is contained in:
parent
abd501741d
commit
3f794b68f9
2 changed files with 52 additions and 0 deletions
25
migrations/12_add_deletedFiles_indexes.js
Normal file
25
migrations/12_add_deletedFiles_indexes.js
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
// Internal ticket: https://github.com/overleaf/issues/issues/4094
|
||||||
|
|
||||||
|
const Settings = require('settings-sharelatex')
|
||||||
|
const mongojs = require('mongojs')
|
||||||
|
const db = mongojs(Settings.mongo.url, ['deletedFiles'])
|
||||||
|
|
||||||
|
const INDEX_FILTER = { 'projectId_1': 1 }
|
||||||
|
const INDEX_OPTIONS = {
|
||||||
|
key: {
|
||||||
|
projectId: 1
|
||||||
|
},
|
||||||
|
background: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.migrate = (client, done) => {
|
||||||
|
db.deletedFiles.ensureIndex(
|
||||||
|
INDEX_FILTER,
|
||||||
|
INDEX_OPTIONS,
|
||||||
|
done
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.rollback = (client, done) => {
|
||||||
|
db.deletedFiles.dropIndex(INDEX_FILTER, done)
|
||||||
|
}
|
27
migrations/13_add_deleted_docs_index.js
Normal file
27
migrations/13_add_deleted_docs_index.js
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
// Internal ticket: https://github.com/overleaf/issues/issues/4211
|
||||||
|
|
||||||
|
const Settings = require('settings-sharelatex')
|
||||||
|
const mongojs = require('mongojs')
|
||||||
|
const db = mongojs(Settings.mongo.url, ['docs'])
|
||||||
|
|
||||||
|
const INDEX_FILTER = { 'project_id_deleted_deletedAt_1': 1 }
|
||||||
|
const INDEX_OPTIONS = {
|
||||||
|
key: {
|
||||||
|
project_id: 1,
|
||||||
|
deleted: 1,
|
||||||
|
deletedAt: -1
|
||||||
|
},
|
||||||
|
background: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.migrate = (client, done) => {
|
||||||
|
db.docs.ensureIndex(
|
||||||
|
INDEX_FILTER,
|
||||||
|
INDEX_OPTIONS,
|
||||||
|
done
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.rollback = (client, done) => {
|
||||||
|
db.docs.dropIndex(INDEX_FILTER, done)
|
||||||
|
}
|
Loading…
Reference in a new issue