mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #20732 from overleaf/revert-20731-revert-20480-ls-convert-migration-scripts-to-esm
Revert "Revert "Convert migration scripts to ESM"" GitOrigin-RevId: 0430a3cd02b9d23bf0f4573346351dcf4ee17fa6
This commit is contained in:
parent
b10d54fdc7
commit
9e15c73228
126 changed files with 1203 additions and 557 deletions
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
"adapter": "./migrations/lib/adapter",
|
"adapter": "./migrations/lib/adapter.mjs",
|
||||||
"migrationNumberFormat": "dateTime"
|
"migrationNumberFormat": "dateTime",
|
||||||
|
"migrationExtension": "mjs"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Helpers.addIndexesToCollection(db.migrations, [
|
await Helpers.addIndexesToCollection(db.migrations, [
|
||||||
{
|
{
|
||||||
|
@ -14,7 +14,7 @@ exports.migrate = async client => {
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -23,3 +23,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -8,15 +8,21 @@
|
||||||
* or "hello <name>", when User.findOne() finds something.
|
* or "hello <name>", when User.findOne() finds something.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const runScript = require('../scripts/example/script_for_migration.js')
|
import runScript from '../scripts/example/script_for_migration.js'
|
||||||
|
|
||||||
exports.tags = []
|
const tags = []
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await runScript()
|
await runScript()
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -14,13 +14,13 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.contacts, indexes)
|
await Helpers.addIndexesToCollection(db.contacts, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -29,3 +29,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -19,13 +19,13 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.deletedProjects, indexes)
|
await Helpers.addIndexesToCollection(db.deletedProjects, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -34,3 +34,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -20,13 +20,13 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.deletedSubscriptions, indexes)
|
await Helpers.addIndexesToCollection(db.deletedSubscriptions, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -35,3 +35,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -13,13 +13,13 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.docHistoryIndex, indexes)
|
await Helpers.addIndexesToCollection(db.docHistoryIndex, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -28,3 +28,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -41,13 +41,13 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.docHistory, indexes)
|
await Helpers.addIndexesToCollection(db.docHistory, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -56,3 +56,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -12,12 +12,18 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async ({ nativeDb }) => {
|
const migrate = async ({ nativeDb }) => {
|
||||||
const docOps = nativeDb.collection('docOps')
|
const docOps = nativeDb.collection('docOps')
|
||||||
await Helpers.addIndexesToCollection(docOps, indexes)
|
await Helpers.addIndexesToCollection(docOps, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async ({ nativeDb }) => {
|
const rollback = async ({ nativeDb }) => {
|
||||||
const docOps = nativeDb.collection('docOps')
|
const docOps = nativeDb.collection('docOps')
|
||||||
await Helpers.dropIndexesFromCollection(docOps, indexes)
|
await Helpers.dropIndexesFromCollection(docOps, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -20,13 +20,13 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.docSnapshots, indexes)
|
await Helpers.addIndexesToCollection(db.docSnapshots, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -35,3 +35,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -13,13 +13,13 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.docs, indexes)
|
await Helpers.addIndexesToCollection(db.docs, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -28,3 +28,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -21,13 +21,13 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.githubSyncEntityVersions, indexes)
|
await Helpers.addIndexesToCollection(db.githubSyncEntityVersions, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -39,3 +39,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -19,13 +19,13 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.githubSyncProjectStates, indexes)
|
await Helpers.addIndexesToCollection(db.githubSyncProjectStates, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -34,3 +34,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -13,13 +13,13 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.githubSyncUserCredentials, indexes)
|
await Helpers.addIndexesToCollection(db.githubSyncUserCredentials, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -31,3 +31,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -14,13 +14,13 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.institutions, indexes)
|
await Helpers.addIndexesToCollection(db.institutions, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -29,3 +29,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -14,13 +14,13 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.messages, indexes)
|
await Helpers.addIndexesToCollection(db.messages, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -29,3 +29,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -26,13 +26,13 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.notifications, indexes)
|
await Helpers.addIndexesToCollection(db.notifications, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -41,3 +41,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -21,13 +21,13 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.oauthAccessTokens, indexes)
|
await Helpers.addIndexesToCollection(db.oauthAccessTokens, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -36,3 +36,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -14,13 +14,13 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.oauthApplications, indexes)
|
await Helpers.addIndexesToCollection(db.oauthApplications, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -29,3 +29,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -14,13 +14,13 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.oauthAuthorizationCodes, indexes)
|
await Helpers.addIndexesToCollection(db.oauthAuthorizationCodes, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -29,3 +29,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -13,13 +13,13 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.projectHistoryFailures, indexes)
|
await Helpers.addIndexesToCollection(db.projectHistoryFailures, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -28,3 +28,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -19,13 +19,13 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.projectHistoryLabels, indexes)
|
await Helpers.addIndexesToCollection(db.projectHistoryLabels, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -34,3 +34,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -13,13 +13,13 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.projectHistoryMetaData, indexes)
|
await Helpers.addIndexesToCollection(db.projectHistoryMetaData, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -28,3 +28,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -20,13 +20,13 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.projectHistorySyncState, indexes)
|
await Helpers.addIndexesToCollection(db.projectHistorySyncState, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -35,3 +35,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,9 +1,10 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
const { getCollectionInternal } = require('../app/src/infrastructure/mongodb')
|
import mongodb from '../app/src/infrastructure/mongodb.js'
|
||||||
|
const { getCollectionInternal } = mongodb
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -19,12 +20,12 @@ async function getCollection() {
|
||||||
return await getCollectionInternal('projectImportFailures')
|
return await getCollectionInternal('projectImportFailures')
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const collection = await getCollection()
|
const collection = await getCollection()
|
||||||
await Helpers.addIndexesToCollection(collection, indexes)
|
await Helpers.addIndexesToCollection(collection, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const collection = await getCollection()
|
const collection = await getCollection()
|
||||||
try {
|
try {
|
||||||
await Helpers.dropIndexesFromCollection(collection, indexes)
|
await Helpers.dropIndexesFromCollection(collection, indexes)
|
||||||
|
@ -32,3 +33,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -20,13 +20,13 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.projectInvites, indexes)
|
await Helpers.addIndexesToCollection(db.projectInvites, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -35,3 +35,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -123,13 +123,13 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.projects, indexes)
|
await Helpers.addIndexesToCollection(db.projects, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -138,3 +138,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -14,13 +14,13 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.publishers, indexes)
|
await Helpers.addIndexesToCollection(db.publishers, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -29,3 +29,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -13,13 +13,13 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.rooms, indexes)
|
await Helpers.addIndexesToCollection(db.rooms, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -28,3 +28,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -13,13 +13,13 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.spellingPreferences, indexes)
|
await Helpers.addIndexesToCollection(db.spellingPreferences, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -28,3 +28,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -68,13 +68,13 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.subscriptions, indexes)
|
await Helpers.addIndexesToCollection(db.subscriptions, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -83,3 +83,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -21,13 +21,13 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.tags, indexes)
|
await Helpers.addIndexesToCollection(db.tags, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -36,3 +36,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-pro', 'saas']
|
const tags = ['server-pro', 'saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -26,13 +26,13 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.templates, indexes)
|
await Helpers.addIndexesToCollection(db.templates, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -41,3 +41,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -15,13 +15,13 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.tokens, indexes)
|
await Helpers.addIndexesToCollection(db.tokens, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -30,3 +30,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -147,13 +147,13 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.users, indexes)
|
await Helpers.addIndexesToCollection(db.users, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -162,3 +162,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -13,13 +13,13 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.userstubs, indexes)
|
await Helpers.addIndexesToCollection(db.userstubs, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -28,3 +28,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,9 +1,10 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
const { getCollectionInternal } = require('../app/src/infrastructure/mongodb')
|
import mongodb from '../app/src/infrastructure/mongodb.js'
|
||||||
|
const { getCollectionInternal } = mongodb
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -29,7 +30,7 @@ const indexes = [
|
||||||
]
|
]
|
||||||
|
|
||||||
// Export indexes for use in the fix-up migration 20220105130000_fix_saml_indexes.js.
|
// Export indexes for use in the fix-up migration 20220105130000_fix_saml_indexes.js.
|
||||||
exports.samlLogsIndexes = indexes
|
const samlLogsIndexes = indexes
|
||||||
|
|
||||||
async function getCollection() {
|
async function getCollection() {
|
||||||
// This collection was incorrectly named - it should have been `samlLogs`
|
// This collection was incorrectly named - it should have been `samlLogs`
|
||||||
|
@ -38,12 +39,12 @@ async function getCollection() {
|
||||||
return await getCollectionInternal('samllog')
|
return await getCollectionInternal('samllog')
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const collection = await getCollection()
|
const collection = await getCollection()
|
||||||
await Helpers.addIndexesToCollection(collection, indexes)
|
await Helpers.addIndexesToCollection(collection, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const collection = await getCollection()
|
const collection = await getCollection()
|
||||||
try {
|
try {
|
||||||
await Helpers.dropIndexesFromCollection(collection, indexes)
|
await Helpers.dropIndexesFromCollection(collection, indexes)
|
||||||
|
@ -51,3 +52,10 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
samlLogsIndexes,
|
||||||
|
}
|
|
@ -1,9 +1,10 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
const { getCollectionInternal } = require('../app/src/infrastructure/mongodb')
|
import mongodb from '../app/src/infrastructure/mongodb.js'
|
||||||
|
const { getCollectionInternal } = mongodb
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -17,7 +18,7 @@ const indexes = [
|
||||||
]
|
]
|
||||||
|
|
||||||
// Export indexes for use in the fix-up migration 20220105130000_fix_saml_indexes.js.
|
// Export indexes for use in the fix-up migration 20220105130000_fix_saml_indexes.js.
|
||||||
exports.usersIndexes = indexes
|
const usersIndexes = indexes
|
||||||
|
|
||||||
async function getCollection() {
|
async function getCollection() {
|
||||||
// This collection was incorrectly named - it should have been `users` instead
|
// This collection was incorrectly named - it should have been `users` instead
|
||||||
|
@ -26,12 +27,12 @@ async function getCollection() {
|
||||||
return await getCollectionInternal('user')
|
return await getCollectionInternal('user')
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const collection = await getCollection()
|
const collection = await getCollection()
|
||||||
await Helpers.addIndexesToCollection(collection, indexes)
|
await Helpers.addIndexesToCollection(collection, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const collection = await getCollection()
|
const collection = await getCollection()
|
||||||
try {
|
try {
|
||||||
await Helpers.dropIndexesFromCollection(collection, indexes)
|
await Helpers.dropIndexesFromCollection(collection, indexes)
|
||||||
|
@ -39,3 +40,10 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
usersIndexes,
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -11,14 +11,20 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async ({ db }) => {
|
const migrate = async ({ db }) => {
|
||||||
await Helpers.addIndexesToCollection(db.projects, indexes)
|
await Helpers.addIndexesToCollection(db.projects, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async ({ db }) => {
|
const rollback = async ({ db }) => {
|
||||||
try {
|
try {
|
||||||
await Helpers.dropIndexesFromCollection(db.projects, indexes)
|
await Helpers.dropIndexesFromCollection(db.projects, indexes)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
const indexes = {
|
const indexes = {
|
||||||
docSnapshots: [{ key: { project_id: 1, ts: 1 }, name: 'project_id_1_ts_1' }],
|
docSnapshots: [{ key: { project_id: 1, ts: 1 }, name: 'project_id_1_ts_1' }],
|
||||||
|
@ -15,7 +15,7 @@ const indexes = {
|
||||||
docs: [{ key: { project_id: 1, inS3: 1 }, name: 'project_id_1_inS3_1' }],
|
docs: [{ key: { project_id: 1, inS3: 1 }, name: 'project_id_1_inS3_1' }],
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
|
@ -25,7 +25,7 @@ exports.migrate = async client => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
|
@ -34,3 +34,9 @@ exports.rollback = async client => {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
async function removeDuplicates(collection, field) {
|
async function removeDuplicates(collection, field) {
|
||||||
const duplicates = await collection.aggregate(
|
const duplicates = await collection.aggregate(
|
||||||
|
@ -31,12 +31,18 @@ async function removeDuplicates(collection, field) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await removeDuplicates(db.deletedProjects, 'deletedProjectId')
|
await removeDuplicates(db.deletedProjects, 'deletedProjectId')
|
||||||
await removeDuplicates(db.deletedUsers, 'deletedUserId')
|
await removeDuplicates(db.deletedUsers, 'deletedUserId')
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
// can't really do anything here
|
// can't really do anything here
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
// deletedUsers did not have an index before
|
// deletedUsers did not have an index before
|
||||||
await Helpers.dropIndexesFromCollection(db.deletedProjects, [
|
await Helpers.dropIndexesFromCollection(db.deletedProjects, [
|
||||||
|
@ -37,7 +37,7 @@ exports.migrate = async client => {
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Helpers.dropIndexesFromCollection(db.deletedProjects, [
|
await Helpers.dropIndexesFromCollection(db.deletedProjects, [
|
||||||
{
|
{
|
||||||
|
@ -68,3 +68,9 @@ exports.rollback = async client => {
|
||||||
])
|
])
|
||||||
// deletedUsers did not have an index before
|
// deletedUsers did not have an index before
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
exports.tags = ['saas']
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
const tags = ['saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -14,12 +14,18 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Helpers.addIndexesToCollection(db.users, indexes)
|
await Helpers.addIndexesToCollection(db.users, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Helpers.dropIndexesFromCollection(db.users, indexes)
|
await Helpers.dropIndexesFromCollection(db.users, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,11 +0,0 @@
|
||||||
const Helpers = require('./lib/helpers')
|
|
||||||
|
|
||||||
exports.tags = ['saas']
|
|
||||||
|
|
||||||
exports.migrate = async client => {
|
|
||||||
await Helpers.dropCollection('projectImportFailures')
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.rollback = async client => {
|
|
||||||
// can't really do anything here
|
|
||||||
}
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
|
const tags = ['saas']
|
||||||
|
|
||||||
|
const migrate = async client => {
|
||||||
|
await Helpers.dropCollection('projectImportFailures')
|
||||||
|
}
|
||||||
|
|
||||||
|
const rollback = async client => {
|
||||||
|
// can't really do anything here
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,11 +0,0 @@
|
||||||
const Helpers = require('./lib/helpers')
|
|
||||||
|
|
||||||
exports.tags = ['saas']
|
|
||||||
|
|
||||||
exports.migrate = async client => {
|
|
||||||
await Helpers.dropCollection('projectImportBatchRecords')
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.rollback = async client => {
|
|
||||||
// can't really do anything here
|
|
||||||
}
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
|
const tags = ['saas']
|
||||||
|
|
||||||
|
const migrate = async client => {
|
||||||
|
await Helpers.dropCollection('projectImportBatchRecords')
|
||||||
|
}
|
||||||
|
|
||||||
|
const rollback = async client => {
|
||||||
|
// can't really do anything here
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -21,13 +21,13 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.addIndexesToCollection(db.samlCache, indexes)
|
await Helpers.addIndexesToCollection(db.samlCache, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -36,3 +36,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
const oldIndex = {
|
const oldIndex = {
|
||||||
unique: true,
|
unique: true,
|
||||||
|
@ -25,14 +25,14 @@ const newIndex = {
|
||||||
sparse: true,
|
sparse: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Helpers.dropIndexesFromCollection(db.subscriptions, [oldIndex])
|
await Helpers.dropIndexesFromCollection(db.subscriptions, [oldIndex])
|
||||||
await Helpers.addIndexesToCollection(db.subscriptions, [newIndex])
|
await Helpers.addIndexesToCollection(db.subscriptions, [newIndex])
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -42,3 +42,9 @@ exports.rollback = async client => {
|
||||||
console.error('Something went wrong rolling back the migrations', err)
|
console.error('Something went wrong rolling back the migrations', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
const index = {
|
const index = {
|
||||||
key: { _id: 1, lastOpened: 1, active: 1 },
|
key: { _id: 1, lastOpened: 1, active: 1 },
|
||||||
|
@ -10,12 +10,18 @@ const index = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Helpers.addIndexesToCollection(db.projects, [index])
|
await Helpers.addIndexesToCollection(db.projects, [index])
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Helpers.dropIndexesFromCollection(db.projects, [index])
|
await Helpers.dropIndexesFromCollection(db.projects, [index])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -11,12 +11,18 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Helpers.addIndexesToCollection(db.deletedFiles, indexes)
|
await Helpers.addIndexesToCollection(db.deletedFiles, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Helpers.dropIndexesFromCollection(db.deletedFiles, indexes)
|
await Helpers.dropIndexesFromCollection(db.deletedFiles, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
const indexes = {
|
const indexes = {
|
||||||
tokens: [
|
tokens: [
|
||||||
|
@ -15,7 +15,7 @@ const indexes = {
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
|
@ -25,7 +25,7 @@ exports.migrate = async client => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
|
@ -34,3 +34,9 @@ exports.rollback = async client => {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -13,12 +13,18 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Helpers.addIndexesToCollection(db.docs, indexes)
|
await Helpers.addIndexesToCollection(db.docs, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Helpers.dropIndexesFromCollection(db.docs, indexes)
|
await Helpers.dropIndexesFromCollection(db.docs, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -11,12 +11,18 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Helpers.addIndexesToCollection(db.projects, indexes)
|
await Helpers.addIndexesToCollection(db.projects, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Helpers.dropIndexesFromCollection(db.projects, indexes)
|
await Helpers.dropIndexesFromCollection(db.projects, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,11 +0,0 @@
|
||||||
const updateStringDates = require('../scripts/confirmed_at_to_dates.js')
|
|
||||||
|
|
||||||
exports.tags = ['saas']
|
|
||||||
|
|
||||||
exports.migrate = async client => {
|
|
||||||
await updateStringDates()
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.rollback = async client => {
|
|
||||||
/* nothing to do */
|
|
||||||
}
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
import updateStringDates from '../scripts/confirmed_at_to_dates.js'
|
||||||
|
|
||||||
|
const tags = ['saas']
|
||||||
|
|
||||||
|
const migrate = async client => {
|
||||||
|
await updateStringDates()
|
||||||
|
}
|
||||||
|
|
||||||
|
const rollback = async client => {
|
||||||
|
/* nothing to do */
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,11 +0,0 @@
|
||||||
const updateStringDates = require('../scripts/split_tests_assigned_at_to_dates')
|
|
||||||
|
|
||||||
exports.tags = ['saas']
|
|
||||||
|
|
||||||
exports.migrate = async client => {
|
|
||||||
await updateStringDates()
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.rollback = async client => {
|
|
||||||
/* nothing to do */
|
|
||||||
}
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
import updateStringDates from '../scripts/confirmed_at_to_dates.js'
|
||||||
|
|
||||||
|
const tags = ['saas']
|
||||||
|
|
||||||
|
const migrate = async client => {
|
||||||
|
await updateStringDates()
|
||||||
|
}
|
||||||
|
|
||||||
|
const rollback = async client => {
|
||||||
|
/* nothing to do */
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,14 +0,0 @@
|
||||||
const runScript = require('../scripts/back_fill_deleted_files.js')
|
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
|
||||||
|
|
||||||
exports.migrate = async client => {
|
|
||||||
const options = {
|
|
||||||
performCleanup: true,
|
|
||||||
letUserDoubleCheckInputsFor: 10,
|
|
||||||
fixPartialInserts: true,
|
|
||||||
}
|
|
||||||
await runScript(options)
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.rollback = async client => {}
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
import runScript from '../scripts/back_fill_deleted_files.js'
|
||||||
|
|
||||||
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
|
const migrate = async client => {
|
||||||
|
const options = {
|
||||||
|
performCleanup: true,
|
||||||
|
letUserDoubleCheckInputsFor: 10,
|
||||||
|
fixPartialInserts: true,
|
||||||
|
}
|
||||||
|
await runScript(options)
|
||||||
|
}
|
||||||
|
|
||||||
|
const rollback = async client => {}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,13 +0,0 @@
|
||||||
const runScript = require('../scripts/back_fill_doc_name_for_deleted_docs.js')
|
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
|
||||||
|
|
||||||
exports.migrate = async client => {
|
|
||||||
const options = {
|
|
||||||
performCleanup: true,
|
|
||||||
letUserDoubleCheckInputsFor: 10,
|
|
||||||
}
|
|
||||||
await runScript(options)
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.rollback = async client => {}
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
import runScript from '../scripts/back_fill_doc_name_for_deleted_docs.js'
|
||||||
|
|
||||||
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
|
const migrate = async client => {
|
||||||
|
const options = {
|
||||||
|
performCleanup: true,
|
||||||
|
letUserDoubleCheckInputsFor: 10,
|
||||||
|
}
|
||||||
|
await runScript(options)
|
||||||
|
}
|
||||||
|
|
||||||
|
const rollback = async client => {}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
const runScript = require('../scripts/back_fill_dummy_doc_meta.js')
|
import runScript from '../scripts/back_fill_dummy_doc_meta.js'
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
const [firstProject] = await db.projects
|
const [firstProject] = await db.projects
|
||||||
.find()
|
.find()
|
||||||
|
@ -20,4 +20,10 @@ exports.migrate = async client => {
|
||||||
await runScript(options)
|
await runScript(options)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {}
|
const rollback = async client => {}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,7 +1,8 @@
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
const { getCollectionInternal } = require('../app/src/infrastructure/mongodb')
|
import mongodb from '../app/src/infrastructure/mongodb.js'
|
||||||
|
const { getCollectionInternal } = mongodb
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -18,12 +19,18 @@ async function getCollection() {
|
||||||
return await getCollectionInternal('splittests')
|
return await getCollectionInternal('splittests')
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const collection = await getCollection()
|
const collection = await getCollection()
|
||||||
await Helpers.addIndexesToCollection(collection, indexes)
|
await Helpers.addIndexesToCollection(collection, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const collection = await getCollection()
|
const collection = await getCollection()
|
||||||
await Helpers.dropIndexesFromCollection(collection, indexes)
|
await Helpers.dropIndexesFromCollection(collection, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
const unusedCollections = [
|
const unusedCollections = [
|
||||||
'collaberatorcount',
|
'collaberatorcount',
|
||||||
|
@ -18,12 +18,18 @@ const unusedCollections = [
|
||||||
'usersEmailDomains',
|
'usersEmailDomains',
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async () => {
|
const migrate = async () => {
|
||||||
for (const name of unusedCollections) {
|
for (const name of unusedCollections) {
|
||||||
await Helpers.dropCollection(name)
|
await Helpers.dropCollection(name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async () => {
|
const rollback = async () => {
|
||||||
// We lost the indexes. There is no way back.
|
// We lost the indexes. There is no way back.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,19 +0,0 @@
|
||||||
const Helpers = require('./lib/helpers')
|
|
||||||
const { samlLogsIndexes } = require('./20191106102104_saml-log-indexes')
|
|
||||||
const { usersIndexes } = require('./20191107191318_saml-indentifiers-index')
|
|
||||||
|
|
||||||
exports.tags = ['saas']
|
|
||||||
|
|
||||||
exports.migrate = async ({ db }) => {
|
|
||||||
// Fix-up the previous SAML migrations that were operating on collections with
|
|
||||||
// typos in their names.
|
|
||||||
await Helpers.addIndexesToCollection(
|
|
||||||
db.users,
|
|
||||||
usersIndexes.map(index => {
|
|
||||||
return Object.assign({}, index, { unique: true })
|
|
||||||
})
|
|
||||||
)
|
|
||||||
await Helpers.addIndexesToCollection(db.samlLogs, samlLogsIndexes)
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.rollback = async () => {}
|
|
28
services/web/migrations/20220105130000_fix_saml_indexes.mjs
Normal file
28
services/web/migrations/20220105130000_fix_saml_indexes.mjs
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
import SamlLogsIndexesMigration from './20191106102104_saml-log-indexes.mjs'
|
||||||
|
import SamlIndentifiersIndexMigration from './20191107191318_saml-indentifiers-index.mjs'
|
||||||
|
|
||||||
|
const { samlLogsIndexes } = SamlLogsIndexesMigration
|
||||||
|
const { usersIndexes } = SamlIndentifiersIndexMigration
|
||||||
|
|
||||||
|
const tags = ['saas']
|
||||||
|
|
||||||
|
const migrate = async ({ db }) => {
|
||||||
|
// Fix-up the previous SAML migrations that were operating on collections with
|
||||||
|
// typos in their names.
|
||||||
|
await Helpers.addIndexesToCollection(
|
||||||
|
db.users,
|
||||||
|
usersIndexes.map(index => {
|
||||||
|
return Object.assign({}, index, { unique: true })
|
||||||
|
})
|
||||||
|
)
|
||||||
|
await Helpers.addIndexesToCollection(db.samlLogs, samlLogsIndexes)
|
||||||
|
}
|
||||||
|
|
||||||
|
const rollback = async () => {}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await db.splittests.updateMany(
|
await db.splittests.updateMany(
|
||||||
{},
|
{},
|
||||||
|
@ -28,7 +28,7 @@ exports.migrate = async client => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await db.splittests.updateMany(
|
await db.splittests.updateMany(
|
||||||
{},
|
{},
|
||||||
|
@ -49,3 +49,9 @@ exports.rollback = async client => {
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -11,12 +11,18 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Helpers.addIndexesToCollection(db.dropboxEntities, indexes)
|
await Helpers.addIndexesToCollection(db.dropboxEntities, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Helpers.dropIndexesFromCollection(db.dropboxEntities, indexes)
|
await Helpers.dropIndexesFromCollection(db.dropboxEntities, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -13,12 +13,18 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Helpers.addIndexesToCollection(db.dropboxProjects, indexes)
|
await Helpers.addIndexesToCollection(db.dropboxProjects, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Helpers.dropIndexesFromCollection(db.dropboxProjects, indexes)
|
await Helpers.dropIndexesFromCollection(db.dropboxProjects, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -13,12 +13,18 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Helpers.addIndexesToCollection(db.dropboxProjects, indexes)
|
await Helpers.addIndexesToCollection(db.dropboxProjects, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Helpers.dropIndexesFromCollection(db.dropboxProjects, indexes)
|
await Helpers.dropIndexesFromCollection(db.dropboxProjects, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -18,7 +18,7 @@ const indexes = [
|
||||||
{ key: { 'overleaf.userId': 1, 'dropbox.pathLower': 'hashed' } },
|
{ key: { 'overleaf.userId': 1, 'dropbox.pathLower': 'hashed' } },
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
// Forcibly drop the dropboxEntities collection. The new structure is
|
// Forcibly drop the dropboxEntities collection. The new structure is
|
||||||
// different and we don't want to keep the data with the old structure around.
|
// different and we don't want to keep the data with the old structure around.
|
||||||
|
@ -26,7 +26,13 @@ exports.migrate = async client => {
|
||||||
await Helpers.addIndexesToCollection(db.dropboxEntities, indexes)
|
await Helpers.addIndexesToCollection(db.dropboxEntities, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Helpers.dropIndexesFromCollection(db.dropboxEntities, indexes)
|
await Helpers.dropIndexesFromCollection(db.dropboxEntities, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,11 +0,0 @@
|
||||||
exports.tags = ['server-ce', 'server-pro']
|
|
||||||
|
|
||||||
exports.migrate = async client => {
|
|
||||||
const { db } = client
|
|
||||||
await db.users.updateMany(
|
|
||||||
{},
|
|
||||||
{ $set: { alphaProgram: false, betaProgram: false } }
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.rollback = async () => {}
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
const tags = ['server-ce', 'server-pro']
|
||||||
|
|
||||||
|
const migrate = async client => {
|
||||||
|
const { db } = client
|
||||||
|
await db.users.updateMany(
|
||||||
|
{},
|
||||||
|
{ $set: { alphaProgram: false, betaProgram: false } }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const rollback = async () => {}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -15,12 +15,18 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Helpers.addIndexesToCollection(db.users, indexes)
|
await Helpers.addIndexesToCollection(db.users, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Helpers.dropIndexesFromCollection(db.users, indexes)
|
await Helpers.dropIndexesFromCollection(db.users, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -13,16 +13,22 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Helpers.addIndexesToCollection(db.projectAuditLogEntries, indexes)
|
await Helpers.addIndexesToCollection(db.projectAuditLogEntries, indexes)
|
||||||
await Helpers.addIndexesToCollection(db.userAuditLogEntries, indexes)
|
await Helpers.addIndexesToCollection(db.userAuditLogEntries, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
Helpers.dropIndexesFromCollection(db.userAuditLogEntries, indexes),
|
Helpers.dropIndexesFromCollection(db.userAuditLogEntries, indexes),
|
||||||
Helpers.dropIndexesFromCollection(db.projectAuditLogEntries, indexes),
|
Helpers.dropIndexesFromCollection(db.projectAuditLogEntries, indexes),
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,14 +0,0 @@
|
||||||
const runScript = require('../scripts/migrate_audit_logs.js')
|
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
|
||||||
|
|
||||||
exports.migrate = async () => {
|
|
||||||
const options = {
|
|
||||||
letUserDoubleCheckInputsFor: 10,
|
|
||||||
writeConcurrency: 5,
|
|
||||||
dryRun: false,
|
|
||||||
}
|
|
||||||
await runScript(options)
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.rollback = async () => {}
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
import runScript from '../scripts/migrate_audit_logs.js'
|
||||||
|
|
||||||
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
|
const migrate = async () => {
|
||||||
|
const options = {
|
||||||
|
letUserDoubleCheckInputsFor: 10,
|
||||||
|
writeConcurrency: 5,
|
||||||
|
dryRun: false,
|
||||||
|
}
|
||||||
|
await runScript(options)
|
||||||
|
}
|
||||||
|
|
||||||
|
const rollback = async () => {}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
const projectIndexes = [
|
const projectIndexes = [
|
||||||
{
|
{
|
||||||
|
@ -20,7 +20,7 @@ const userIndexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Helpers.addIndexesToCollection(
|
await Helpers.addIndexesToCollection(
|
||||||
db.projectAuditLogEntries,
|
db.projectAuditLogEntries,
|
||||||
|
@ -29,7 +29,7 @@ exports.migrate = async client => {
|
||||||
await Helpers.addIndexesToCollection(db.userAuditLogEntries, userIndexes)
|
await Helpers.addIndexesToCollection(db.userAuditLogEntries, userIndexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
Helpers.dropIndexesFromCollection(
|
Helpers.dropIndexesFromCollection(
|
||||||
|
@ -39,3 +39,9 @@ exports.rollback = async client => {
|
||||||
Helpers.dropIndexesFromCollection(db.userAuditLogEntries, userIndexes),
|
Helpers.dropIndexesFromCollection(db.userAuditLogEntries, userIndexes),
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,9 +0,0 @@
|
||||||
const runScript = require('../scripts/convert_archived_state')
|
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro']
|
|
||||||
|
|
||||||
exports.migrate = async () => {
|
|
||||||
await runScript('FIRST,SECOND')
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.rollback = async () => {}
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
import runScript from '../scripts/convert_archived_state.js'
|
||||||
|
|
||||||
|
const tags = ['server-ce', 'server-pro']
|
||||||
|
|
||||||
|
const migrate = async () => {
|
||||||
|
await runScript('FIRST,SECOND')
|
||||||
|
}
|
||||||
|
|
||||||
|
const rollback = async () => {}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -18,10 +18,16 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async ({ db }) => {
|
const migrate = async ({ db }) => {
|
||||||
await Helpers.addIndexesToCollection(db.projectHistoryChunks, indexes)
|
await Helpers.addIndexesToCollection(db.projectHistoryChunks, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async ({ db }) => {
|
const rollback = async ({ db }) => {
|
||||||
await Helpers.dropIndexesFromCollection(db.projectHistoryChunks, indexes)
|
await Helpers.dropIndexesFromCollection(db.projectHistoryChunks, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
// 'recurly' -> 'recurlyStatus'
|
// 'recurly' -> 'recurlyStatus'
|
||||||
await db.subscriptions.updateMany(
|
await db.subscriptions.updateMany(
|
||||||
|
@ -28,7 +28,7 @@ exports.migrate = async client => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
// 'recurlyStatus' -> 'recurly'
|
// 'recurlyStatus' -> 'recurly'
|
||||||
await db.subscriptions.updateMany(
|
await db.subscriptions.updateMany(
|
||||||
|
@ -51,3 +51,9 @@ exports.rollback = async client => {
|
||||||
{ $unset: { recurlyStatus: 1 } }
|
{ $unset: { recurlyStatus: 1 } }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,13 +1,14 @@
|
||||||
const { batchedUpdate } = require('../scripts/helpers/batchedUpdate')
|
import BatchedUpdateScript from '../scripts/helpers/batchedUpdate.js'
|
||||||
|
const { batchedUpdate } = BatchedUpdateScript
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
const batchedUpdateOptions = {
|
const batchedUpdateOptions = {
|
||||||
VERBOSE_LOGGING: 'true',
|
VERBOSE_LOGGING: 'true',
|
||||||
BATCH_SIZE: '1',
|
BATCH_SIZE: '1',
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.migrate = async () => {
|
const migrate = async () => {
|
||||||
await batchedUpdate(
|
await batchedUpdate(
|
||||||
'users',
|
'users',
|
||||||
{ 'twoFactorAuthentication.secret': { $exists: true } },
|
{ 'twoFactorAuthentication.secret': { $exists: true } },
|
||||||
|
@ -18,7 +19,7 @@ exports.migrate = async () => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async () => {
|
const rollback = async () => {
|
||||||
await batchedUpdate(
|
await batchedUpdate(
|
||||||
'users',
|
'users',
|
||||||
{ 'twoFactorAuthentication.secretEncrypted': { $exists: true } },
|
{ 'twoFactorAuthentication.secretEncrypted': { $exists: true } },
|
||||||
|
@ -28,3 +29,9 @@ exports.rollback = async () => {
|
||||||
batchedUpdateOptions
|
batchedUpdateOptions
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
db.subscriptions.updateMany(
|
db.subscriptions.updateMany(
|
||||||
{
|
{
|
||||||
|
@ -36,6 +36,12 @@ exports.migrate = async client => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
// There is no way back.
|
// There is no way back.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -15,10 +15,16 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async ({ db }) => {
|
const migrate = async ({ db }) => {
|
||||||
await Helpers.addIndexesToCollection(db.projectHistoryChunks, indexes)
|
await Helpers.addIndexesToCollection(db.projectHistoryChunks, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async ({ db }) => {
|
const rollback = async ({ db }) => {
|
||||||
await Helpers.dropIndexesFromCollection(db.projectHistoryChunks, indexes)
|
await Helpers.dropIndexesFromCollection(db.projectHistoryChunks, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,9 +0,0 @@
|
||||||
const runScript = require('../scripts/back_fill_doc_rev')
|
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro']
|
|
||||||
|
|
||||||
exports.migrate = async () => {
|
|
||||||
await runScript(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.rollback = async () => {}
|
|
15
services/web/migrations/20230315170739_back_fill_doc_rev.mjs
Normal file
15
services/web/migrations/20230315170739_back_fill_doc_rev.mjs
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
import runScript from '../scripts/back_fill_doc_rev.js'
|
||||||
|
|
||||||
|
const tags = ['server-ce', 'server-pro']
|
||||||
|
|
||||||
|
const migrate = async () => {
|
||||||
|
await runScript(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
const rollback = async () => {}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
const OLD_INDEX = {
|
const OLD_INDEX = {
|
||||||
key: { refreshToken: 1 },
|
key: { refreshToken: 1 },
|
||||||
|
@ -18,7 +18,7 @@ const TMP_INDEX = {
|
||||||
name: 'refreshToken_tmp',
|
name: 'refreshToken_tmp',
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
// Create a temporary index so that the refresh tokens are not left unindexed
|
// Create a temporary index so that the refresh tokens are not left unindexed
|
||||||
// while we drop the index and recreate it.
|
// while we drop the index and recreate it.
|
||||||
|
@ -32,7 +32,7 @@ exports.migrate = async client => {
|
||||||
await Helpers.dropIndexesFromCollection(db.oauthAccessTokens, [TMP_INDEX])
|
await Helpers.dropIndexesFromCollection(db.oauthAccessTokens, [TMP_INDEX])
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
// Create a temporary index so that the refresh tokens are not left unindexed
|
// Create a temporary index so that the refresh tokens are not left unindexed
|
||||||
// while we drop the index and recreate it.
|
// while we drop the index and recreate it.
|
||||||
|
@ -45,3 +45,9 @@ exports.rollback = async client => {
|
||||||
// Drop the temporary index
|
// Drop the temporary index
|
||||||
await Helpers.dropIndexesFromCollection(db.oauthAccessTokens, [TMP_INDEX])
|
await Helpers.dropIndexesFromCollection(db.oauthAccessTokens, [TMP_INDEX])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
const ACCESS_TOKENS_INDEX = {
|
const ACCESS_TOKENS_INDEX = {
|
||||||
name: 'expiresAt_1',
|
name: 'expiresAt_1',
|
||||||
|
@ -16,7 +16,7 @@ const AUTHORIZATION_CODES_INDEX = {
|
||||||
expireAfterSeconds: 0,
|
expireAfterSeconds: 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.migrate = async ({ db }) => {
|
const migrate = async ({ db }) => {
|
||||||
await Helpers.addIndexesToCollection(db.oauthAccessTokens, [
|
await Helpers.addIndexesToCollection(db.oauthAccessTokens, [
|
||||||
ACCESS_TOKENS_INDEX,
|
ACCESS_TOKENS_INDEX,
|
||||||
])
|
])
|
||||||
|
@ -25,7 +25,7 @@ exports.migrate = async ({ db }) => {
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async ({ db }) => {
|
const rollback = async ({ db }) => {
|
||||||
await Helpers.dropIndexesFromCollection(db.oauthAccessTokens, [
|
await Helpers.dropIndexesFromCollection(db.oauthAccessTokens, [
|
||||||
ACCESS_TOKENS_INDEX,
|
ACCESS_TOKENS_INDEX,
|
||||||
])
|
])
|
||||||
|
@ -33,3 +33,9 @@ exports.rollback = async ({ db }) => {
|
||||||
AUTHORIZATION_CODES_INDEX,
|
AUTHORIZATION_CODES_INDEX,
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -10,12 +10,18 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Helpers.addIndexesToCollection(db.oauthAccessTokens, indexes)
|
await Helpers.addIndexesToCollection(db.oauthAccessTokens, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Helpers.dropIndexesFromCollection(db.oauthAccessTokens, indexes)
|
await Helpers.dropIndexesFromCollection(db.oauthAccessTokens, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
const tags = ['server-ce', 'server-pro', 'saas']
|
||||||
|
|
||||||
const oldIndexes = [
|
const oldIndexes = [
|
||||||
{
|
{
|
||||||
|
@ -45,14 +45,20 @@ const newIndexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Helpers.addIndexesToCollection(db.projectHistoryChunks, newIndexes)
|
await Helpers.addIndexesToCollection(db.projectHistoryChunks, newIndexes)
|
||||||
await Helpers.dropIndexesFromCollection(db.projectHistoryChunks, oldIndexes)
|
await Helpers.dropIndexesFromCollection(db.projectHistoryChunks, oldIndexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Helpers.addIndexesToCollection(db.projectHistoryChunks, oldIndexes)
|
await Helpers.addIndexesToCollection(db.projectHistoryChunks, oldIndexes)
|
||||||
await Helpers.dropIndexesFromCollection(db.projectHistoryChunks, newIndexes)
|
await Helpers.dropIndexesFromCollection(db.projectHistoryChunks, newIndexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['server-pro']
|
const tags = ['server-pro']
|
||||||
|
|
||||||
const OAUTH_APPLICATIONS_INDEX = {
|
const OAUTH_APPLICATIONS_INDEX = {
|
||||||
key: { id: 1 },
|
key: { id: 1 },
|
||||||
|
@ -20,7 +20,7 @@ const OAUTH_AUTHORIZATION_CODES_INDEX = {
|
||||||
name: 'authorizationCode_1',
|
name: 'authorizationCode_1',
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Helpers.addIndexesToCollection(db.oauthApplications, [
|
await Helpers.addIndexesToCollection(db.oauthApplications, [
|
||||||
OAUTH_APPLICATIONS_INDEX,
|
OAUTH_APPLICATIONS_INDEX,
|
||||||
|
@ -33,7 +33,7 @@ exports.migrate = async client => {
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Helpers.dropIndexesFromCollection(db.oauthApplications, [
|
await Helpers.dropIndexesFromCollection(db.oauthApplications, [
|
||||||
OAUTH_APPLICATIONS_INDEX,
|
OAUTH_APPLICATIONS_INDEX,
|
||||||
|
@ -45,3 +45,9 @@ exports.rollback = async client => {
|
||||||
OAUTH_AUTHORIZATION_CODES_INDEX,
|
OAUTH_AUTHORIZATION_CODES_INDEX,
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,9 +1,10 @@
|
||||||
const { promisify } = require('util')
|
import util from 'util'
|
||||||
|
const { promisify } = util
|
||||||
const sleep = promisify(setTimeout)
|
const sleep = promisify(setTimeout)
|
||||||
|
|
||||||
exports.tags = ['server-ce', 'server-pro']
|
const tags = ['server-ce', 'server-pro']
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
const count = await db.projects.countDocuments({
|
const count = await db.projects.countDocuments({
|
||||||
'overleaf.history.display': { $ne: true },
|
'overleaf.history.display': { $ne: true },
|
||||||
|
@ -48,6 +49,12 @@ exports.migrate = async client => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
// Not applicable
|
// Not applicable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
const index = {
|
const index = {
|
||||||
key: {
|
key: {
|
||||||
|
@ -11,12 +11,18 @@ const index = {
|
||||||
name: 'featuresUpdatedAt_1',
|
name: 'featuresUpdatedAt_1',
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Helpers.addIndexesToCollection(db.users, [index])
|
await Helpers.addIndexesToCollection(db.users, [index])
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await Helpers.dropIndexesFromCollection(db.users, [index])
|
await Helpers.dropIndexesFromCollection(db.users, [index])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,11 +0,0 @@
|
||||||
exports.tags = ['server-ce', 'server-pro']
|
|
||||||
|
|
||||||
exports.migrate = async () => {
|
|
||||||
// Run-time import as SaaS does not ship with the server-ce-scripts module
|
|
||||||
const runScript = require('../modules/server-ce-scripts/scripts/upgrade-user-features')
|
|
||||||
await runScript(false, {
|
|
||||||
gitBridge: 1,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.rollback = async () => {}
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
const tags = ['server-ce', 'server-pro']
|
||||||
|
|
||||||
|
const migrate = async () => {
|
||||||
|
// Run-time import as SaaS does not ship with the server-ce-scripts module
|
||||||
|
const { default: runScript } = await import(
|
||||||
|
'../modules/server-ce-scripts/scripts/upgrade-user-features.js'
|
||||||
|
)
|
||||||
|
await runScript(false, {
|
||||||
|
gitBridge: 1,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const rollback = async () => {}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await db.subscriptions.updateMany(
|
await db.subscriptions.updateMany(
|
||||||
{ 'features.managedUsers': { $ne: true } },
|
{ 'features.managedUsers': { $ne: true } },
|
||||||
|
@ -8,10 +8,16 @@ exports.migrate = async client => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await db.subscriptions.updateMany(
|
await db.subscriptions.updateMany(
|
||||||
{ 'features.managedUsers': { $eq: null } },
|
{ 'features.managedUsers': { $eq: null } },
|
||||||
{ $set: { 'features.managedUsers': false } }
|
{ $set: { 'features.managedUsers': false } }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
const Helpers = require('./lib/helpers')
|
import Helpers from './lib/helpers.mjs'
|
||||||
|
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
const indexes = [
|
const indexes = [
|
||||||
{
|
{
|
||||||
|
@ -9,10 +9,16 @@ const indexes = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.migrate = async ({ db }) => {
|
const migrate = async ({ db }) => {
|
||||||
await Helpers.dropIndexesFromCollection(db.projects, indexes)
|
await Helpers.dropIndexesFromCollection(db.projects, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async ({ db }) => {
|
const rollback = async ({ db }) => {
|
||||||
await Helpers.addIndexesToCollection(db.projects, indexes)
|
await Helpers.addIndexesToCollection(db.projects, indexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
exports.tags = ['saas']
|
const tags = ['saas']
|
||||||
|
|
||||||
exports.migrate = async client => {
|
const migrate = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await db.ssoConfigs.updateMany(
|
await db.ssoConfigs.updateMany(
|
||||||
{ certificate: { $exists: true }, certificates: { $exists: false } },
|
{ certificate: { $exists: true }, certificates: { $exists: false } },
|
||||||
|
@ -21,7 +21,7 @@ exports.migrate = async client => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.rollback = async client => {
|
const rollback = async client => {
|
||||||
const { db } = client
|
const { db } = client
|
||||||
await db.ssoConfigs.updateMany(
|
await db.ssoConfigs.updateMany(
|
||||||
{ certificate: { $exists: false }, certificates: { $exists: true } },
|
{ certificate: { $exists: false }, certificates: { $exists: true } },
|
||||||
|
@ -33,3 +33,9 @@ exports.rollback = async client => {
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
tags,
|
||||||
|
migrate,
|
||||||
|
rollback,
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue