mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #20480 from overleaf/ls-convert-migration-scripts-to-esm
Convert migration scripts to ESM GitOrigin-RevId: 46f04a1837ebb8244b1156af2d58162d024b6b2d
This commit is contained in:
parent
af811ec1ed
commit
492fe24a75
126 changed files with 1202 additions and 557 deletions
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"adapter": "./migrations/lib/adapter",
|
||||
"migrationNumberFormat": "dateTime"
|
||||
"adapter": "./migrations/lib/adapter.mjs",
|
||||
"migrationNumberFormat": "dateTime",
|
||||
"migrationExtension": "mjs"
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* 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
|
||||
await Helpers.addIndexesToCollection(db.migrations, [
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ exports.migrate = async client => {
|
|||
])
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -23,3 +23,9 @@ exports.rollback = async client => {
|
|||
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.
|
||||
*/
|
||||
|
||||
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
|
||||
await runScript()
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* 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 = [
|
||||
{
|
||||
|
@ -14,13 +14,13 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.contacts, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -29,3 +29,9 @@ exports.rollback = async client => {
|
|||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* 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 = [
|
||||
{
|
||||
|
@ -19,13 +19,13 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.deletedProjects, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -34,3 +34,9 @@ exports.rollback = async client => {
|
|||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
|
||||
const Helpers = require('./lib/helpers')
|
||||
import Helpers from './lib/helpers.mjs'
|
||||
|
||||
exports.tags = ['saas']
|
||||
const tags = ['saas']
|
||||
|
||||
const indexes = [
|
||||
{
|
||||
|
@ -20,13 +20,13 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.deletedSubscriptions, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -35,3 +35,9 @@ exports.rollback = async client => {
|
|||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* 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 = [
|
||||
{
|
||||
|
@ -13,13 +13,13 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.docHistoryIndex, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -28,3 +28,9 @@ exports.rollback = async client => {
|
|||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* 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 = [
|
||||
{
|
||||
|
@ -41,13 +41,13 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.docHistory, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -56,3 +56,9 @@ exports.rollback = async client => {
|
|||
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 = [
|
||||
{
|
||||
|
@ -12,12 +12,18 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async ({ nativeDb }) => {
|
||||
const migrate = async ({ nativeDb }) => {
|
||||
const docOps = nativeDb.collection('docOps')
|
||||
await Helpers.addIndexesToCollection(docOps, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async ({ nativeDb }) => {
|
||||
const rollback = async ({ nativeDb }) => {
|
||||
const docOps = nativeDb.collection('docOps')
|
||||
await Helpers.dropIndexesFromCollection(docOps, indexes)
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* 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 = [
|
||||
{
|
||||
|
@ -20,13 +20,13 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.docSnapshots, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -35,3 +35,9 @@ exports.rollback = async client => {
|
|||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* 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 = [
|
||||
{
|
||||
|
@ -13,13 +13,13 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.docs, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -28,3 +28,9 @@ exports.rollback = async client => {
|
|||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
|
||||
const Helpers = require('./lib/helpers')
|
||||
import Helpers from './lib/helpers.mjs'
|
||||
|
||||
exports.tags = ['saas']
|
||||
const tags = ['saas']
|
||||
|
||||
const indexes = [
|
||||
{
|
||||
|
@ -21,13 +21,13 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.githubSyncEntityVersions, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -39,3 +39,9 @@ exports.rollback = async client => {
|
|||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
|
||||
const Helpers = require('./lib/helpers')
|
||||
import Helpers from './lib/helpers.mjs'
|
||||
|
||||
exports.tags = ['saas']
|
||||
const tags = ['saas']
|
||||
|
||||
const indexes = [
|
||||
{
|
||||
|
@ -19,13 +19,13 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.githubSyncProjectStates, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -34,3 +34,9 @@ exports.rollback = async client => {
|
|||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
|
||||
const Helpers = require('./lib/helpers')
|
||||
import Helpers from './lib/helpers.mjs'
|
||||
|
||||
exports.tags = ['saas']
|
||||
const tags = ['saas']
|
||||
|
||||
const indexes = [
|
||||
{
|
||||
|
@ -13,13 +13,13 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.githubSyncUserCredentials, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -31,3 +31,9 @@ exports.rollback = async client => {
|
|||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
|
||||
const Helpers = require('./lib/helpers')
|
||||
import Helpers from './lib/helpers.mjs'
|
||||
|
||||
exports.tags = ['saas']
|
||||
const tags = ['saas']
|
||||
|
||||
const indexes = [
|
||||
{
|
||||
|
@ -14,13 +14,13 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.institutions, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -29,3 +29,9 @@ exports.rollback = async client => {
|
|||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* 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 = [
|
||||
{
|
||||
|
@ -14,13 +14,13 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.messages, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -29,3 +29,9 @@ exports.rollback = async client => {
|
|||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* 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 = [
|
||||
{
|
||||
|
@ -26,13 +26,13 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.notifications, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -41,3 +41,9 @@ exports.rollback = async client => {
|
|||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
|
||||
const Helpers = require('./lib/helpers')
|
||||
import Helpers from './lib/helpers.mjs'
|
||||
|
||||
exports.tags = ['saas']
|
||||
const tags = ['saas']
|
||||
|
||||
const indexes = [
|
||||
{
|
||||
|
@ -21,13 +21,13 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.oauthAccessTokens, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -36,3 +36,9 @@ exports.rollback = async client => {
|
|||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
|
||||
const Helpers = require('./lib/helpers')
|
||||
import Helpers from './lib/helpers.mjs'
|
||||
|
||||
exports.tags = ['saas']
|
||||
const tags = ['saas']
|
||||
|
||||
const indexes = [
|
||||
{
|
||||
|
@ -14,13 +14,13 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.oauthApplications, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -29,3 +29,9 @@ exports.rollback = async client => {
|
|||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
|
||||
const Helpers = require('./lib/helpers')
|
||||
import Helpers from './lib/helpers.mjs'
|
||||
|
||||
exports.tags = ['saas']
|
||||
const tags = ['saas']
|
||||
|
||||
const indexes = [
|
||||
{
|
||||
|
@ -14,13 +14,13 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.oauthAuthorizationCodes, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -29,3 +29,9 @@ exports.rollback = async client => {
|
|||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
|
||||
const Helpers = require('./lib/helpers')
|
||||
import Helpers from './lib/helpers.mjs'
|
||||
|
||||
exports.tags = ['saas']
|
||||
const tags = ['saas']
|
||||
|
||||
const indexes = [
|
||||
{
|
||||
|
@ -13,13 +13,13 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.projectHistoryFailures, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -28,3 +28,9 @@ exports.rollback = async client => {
|
|||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
|
||||
const Helpers = require('./lib/helpers')
|
||||
import Helpers from './lib/helpers.mjs'
|
||||
|
||||
exports.tags = ['saas']
|
||||
const tags = ['saas']
|
||||
|
||||
const indexes = [
|
||||
{
|
||||
|
@ -19,13 +19,13 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.projectHistoryLabels, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -34,3 +34,9 @@ exports.rollback = async client => {
|
|||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
|
||||
const Helpers = require('./lib/helpers')
|
||||
import Helpers from './lib/helpers.mjs'
|
||||
|
||||
exports.tags = ['saas']
|
||||
const tags = ['saas']
|
||||
|
||||
const indexes = [
|
||||
{
|
||||
|
@ -13,13 +13,13 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.projectHistoryMetaData, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -28,3 +28,9 @@ exports.rollback = async client => {
|
|||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
|
||||
const Helpers = require('./lib/helpers')
|
||||
import Helpers from './lib/helpers.mjs'
|
||||
|
||||
exports.tags = ['saas']
|
||||
const tags = ['saas']
|
||||
|
||||
const indexes = [
|
||||
{
|
||||
|
@ -20,13 +20,13 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.projectHistorySyncState, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -35,3 +35,9 @@ exports.rollback = async client => {
|
|||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,9 +1,10 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
|
||||
const Helpers = require('./lib/helpers')
|
||||
const { getCollectionInternal } = require('../app/src/infrastructure/mongodb')
|
||||
import Helpers from './lib/helpers.mjs'
|
||||
import mongodb from '../app/src/infrastructure/mongodb.js'
|
||||
const { getCollectionInternal } = mongodb
|
||||
|
||||
exports.tags = ['saas']
|
||||
const tags = ['saas']
|
||||
|
||||
const indexes = [
|
||||
{
|
||||
|
@ -19,12 +20,12 @@ async function getCollection() {
|
|||
return await getCollectionInternal('projectImportFailures')
|
||||
}
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const collection = await getCollection()
|
||||
await Helpers.addIndexesToCollection(collection, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const collection = await getCollection()
|
||||
try {
|
||||
await Helpers.dropIndexesFromCollection(collection, indexes)
|
||||
|
@ -32,3 +33,9 @@ exports.rollback = async client => {
|
|||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* 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 = [
|
||||
{
|
||||
|
@ -20,13 +20,13 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.projectInvites, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -35,3 +35,9 @@ exports.rollback = async client => {
|
|||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* 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 = [
|
||||
{
|
||||
|
@ -123,13 +123,13 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.projects, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -138,3 +138,9 @@ exports.rollback = async client => {
|
|||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
|
||||
const Helpers = require('./lib/helpers')
|
||||
import Helpers from './lib/helpers.mjs'
|
||||
|
||||
exports.tags = ['saas']
|
||||
const tags = ['saas']
|
||||
|
||||
const indexes = [
|
||||
{
|
||||
|
@ -14,13 +14,13 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.publishers, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -29,3 +29,9 @@ exports.rollback = async client => {
|
|||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* 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 = [
|
||||
{
|
||||
|
@ -13,13 +13,13 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.rooms, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -28,3 +28,9 @@ exports.rollback = async client => {
|
|||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* 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 = [
|
||||
{
|
||||
|
@ -13,13 +13,13 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.spellingPreferences, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -28,3 +28,9 @@ exports.rollback = async client => {
|
|||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
|
||||
const Helpers = require('./lib/helpers')
|
||||
import Helpers from './lib/helpers.mjs'
|
||||
|
||||
exports.tags = ['saas']
|
||||
const tags = ['saas']
|
||||
|
||||
const indexes = [
|
||||
{
|
||||
|
@ -68,13 +68,13 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.subscriptions, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -83,3 +83,9 @@ exports.rollback = async client => {
|
|||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* 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 = [
|
||||
{
|
||||
|
@ -21,13 +21,13 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.tags, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -36,3 +36,9 @@ exports.rollback = async client => {
|
|||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* 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 = [
|
||||
{
|
||||
|
@ -26,13 +26,13 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.templates, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -41,3 +41,9 @@ exports.rollback = async client => {
|
|||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* 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 = [
|
||||
{
|
||||
|
@ -15,13 +15,13 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.tokens, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -30,3 +30,9 @@ exports.rollback = async client => {
|
|||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* 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 = [
|
||||
{
|
||||
|
@ -147,13 +147,13 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.users, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -162,3 +162,9 @@ exports.rollback = async client => {
|
|||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
|
||||
const Helpers = require('./lib/helpers')
|
||||
import Helpers from './lib/helpers.mjs'
|
||||
|
||||
exports.tags = ['saas']
|
||||
const tags = ['saas']
|
||||
|
||||
const indexes = [
|
||||
{
|
||||
|
@ -13,13 +13,13 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.userstubs, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -28,3 +28,9 @@ exports.rollback = async client => {
|
|||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,9 +1,10 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
|
||||
const Helpers = require('./lib/helpers')
|
||||
const { getCollectionInternal } = require('../app/src/infrastructure/mongodb')
|
||||
import Helpers from './lib/helpers.mjs'
|
||||
import mongodb from '../app/src/infrastructure/mongodb.js'
|
||||
const { getCollectionInternal } = mongodb
|
||||
|
||||
exports.tags = ['saas']
|
||||
const tags = ['saas']
|
||||
|
||||
const indexes = [
|
||||
{
|
||||
|
@ -29,7 +30,7 @@ const indexes = [
|
|||
]
|
||||
|
||||
// Export indexes for use in the fix-up migration 20220105130000_fix_saml_indexes.js.
|
||||
exports.samlLogsIndexes = indexes
|
||||
const samlLogsIndexes = indexes
|
||||
|
||||
async function getCollection() {
|
||||
// This collection was incorrectly named - it should have been `samlLogs`
|
||||
|
@ -38,12 +39,12 @@ async function getCollection() {
|
|||
return await getCollectionInternal('samllog')
|
||||
}
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const collection = await getCollection()
|
||||
await Helpers.addIndexesToCollection(collection, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const collection = await getCollection()
|
||||
try {
|
||||
await Helpers.dropIndexesFromCollection(collection, indexes)
|
||||
|
@ -51,3 +52,10 @@ exports.rollback = async client => {
|
|||
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 */
|
||||
|
||||
const Helpers = require('./lib/helpers')
|
||||
const { getCollectionInternal } = require('../app/src/infrastructure/mongodb')
|
||||
import Helpers from './lib/helpers.mjs'
|
||||
import mongodb from '../app/src/infrastructure/mongodb.js'
|
||||
const { getCollectionInternal } = mongodb
|
||||
|
||||
exports.tags = ['saas']
|
||||
const tags = ['saas']
|
||||
|
||||
const indexes = [
|
||||
{
|
||||
|
@ -17,7 +18,7 @@ const indexes = [
|
|||
]
|
||||
|
||||
// Export indexes for use in the fix-up migration 20220105130000_fix_saml_indexes.js.
|
||||
exports.usersIndexes = indexes
|
||||
const usersIndexes = indexes
|
||||
|
||||
async function getCollection() {
|
||||
// This collection was incorrectly named - it should have been `users` instead
|
||||
|
@ -26,12 +27,12 @@ async function getCollection() {
|
|||
return await getCollectionInternal('user')
|
||||
}
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const collection = await getCollection()
|
||||
await Helpers.addIndexesToCollection(collection, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const collection = await getCollection()
|
||||
try {
|
||||
await Helpers.dropIndexesFromCollection(collection, indexes)
|
||||
|
@ -39,3 +40,10 @@ exports.rollback = async client => {
|
|||
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 = [
|
||||
{
|
||||
|
@ -11,14 +11,20 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async ({ db }) => {
|
||||
const migrate = async ({ db }) => {
|
||||
await Helpers.addIndexesToCollection(db.projects, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async ({ db }) => {
|
||||
const rollback = async ({ db }) => {
|
||||
try {
|
||||
await Helpers.dropIndexesFromCollection(db.projects, indexes)
|
||||
} catch (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 */
|
||||
|
||||
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 = {
|
||||
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' }],
|
||||
}
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Promise.all(
|
||||
|
@ -25,7 +25,7 @@ exports.migrate = async client => {
|
|||
)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
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 */
|
||||
|
||||
exports.tags = ['server-ce', 'server-pro', 'saas']
|
||||
const tags = ['server-ce', 'server-pro', 'saas']
|
||||
|
||||
async function removeDuplicates(collection, field) {
|
||||
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
|
||||
await removeDuplicates(db.deletedProjects, 'deletedProjectId')
|
||||
await removeDuplicates(db.deletedUsers, 'deletedUserId')
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
// can't really do anything here
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
/* 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
|
||||
// deletedUsers did not have an index before
|
||||
await Helpers.dropIndexesFromCollection(db.deletedProjects, [
|
||||
|
@ -37,7 +37,7 @@ exports.migrate = async client => {
|
|||
])
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
await Helpers.dropIndexesFromCollection(db.deletedProjects, [
|
||||
{
|
||||
|
@ -68,3 +68,9 @@ exports.rollback = async client => {
|
|||
])
|
||||
// deletedUsers did not have an index before
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
|
||||
exports.tags = ['saas']
|
||||
import Helpers from './lib/helpers.mjs'
|
||||
|
||||
const Helpers = require('./lib/helpers')
|
||||
const tags = ['saas']
|
||||
|
||||
const indexes = [
|
||||
{
|
||||
|
@ -14,12 +14,18 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
await Helpers.addIndexesToCollection(db.users, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
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 */
|
||||
|
||||
const Helpers = require('./lib/helpers')
|
||||
import Helpers from './lib/helpers.mjs'
|
||||
|
||||
exports.tags = ['saas']
|
||||
const tags = ['saas']
|
||||
|
||||
const indexes = [
|
||||
{
|
||||
|
@ -21,13 +21,13 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.addIndexesToCollection(db.samlCache, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -36,3 +36,9 @@ exports.rollback = async client => {
|
|||
console.error('Something went wrong rolling back the migrations', err)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
|
||||
const Helpers = require('./lib/helpers')
|
||||
import Helpers from './lib/helpers.mjs'
|
||||
|
||||
exports.tags = ['saas']
|
||||
const tags = ['saas']
|
||||
|
||||
const oldIndex = {
|
||||
unique: true,
|
||||
|
@ -25,14 +25,14 @@ const newIndex = {
|
|||
sparse: true,
|
||||
}
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Helpers.dropIndexesFromCollection(db.subscriptions, [oldIndex])
|
||||
await Helpers.addIndexesToCollection(db.subscriptions, [newIndex])
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
try {
|
||||
|
@ -42,3 +42,9 @@ exports.rollback = async client => {
|
|||
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 = {
|
||||
key: { _id: 1, lastOpened: 1, active: 1 },
|
||||
|
@ -10,12 +10,18 @@ const index = {
|
|||
},
|
||||
}
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
await Helpers.addIndexesToCollection(db.projects, [index])
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
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 = [
|
||||
{
|
||||
|
@ -11,12 +11,18 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
await Helpers.addIndexesToCollection(db.deletedFiles, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
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 = {
|
||||
tokens: [
|
||||
|
@ -15,7 +15,7 @@ const indexes = {
|
|||
],
|
||||
}
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
|
||||
await Promise.all(
|
||||
|
@ -25,7 +25,7 @@ exports.migrate = async client => {
|
|||
)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
|
||||
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 = [
|
||||
{
|
||||
|
@ -13,12 +13,18 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
await Helpers.addIndexesToCollection(db.docs, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
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 = [
|
||||
{
|
||||
|
@ -11,12 +11,18 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
await Helpers.addIndexesToCollection(db.projects, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
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 [firstProject] = await db.projects
|
||||
.find()
|
||||
|
@ -20,4 +20,10 @@ exports.migrate = async client => {
|
|||
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')
|
||||
const { getCollectionInternal } = require('../app/src/infrastructure/mongodb')
|
||||
import Helpers from './lib/helpers.mjs'
|
||||
import mongodb from '../app/src/infrastructure/mongodb.js'
|
||||
const { getCollectionInternal } = mongodb
|
||||
|
||||
exports.tags = ['saas']
|
||||
const tags = ['saas']
|
||||
|
||||
const indexes = [
|
||||
{
|
||||
|
@ -18,12 +19,18 @@ async function getCollection() {
|
|||
return await getCollectionInternal('splittests')
|
||||
}
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const collection = await getCollection()
|
||||
await Helpers.addIndexesToCollection(collection, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const collection = await getCollection()
|
||||
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 = [
|
||||
'collaberatorcount',
|
||||
|
@ -18,12 +18,18 @@ const unusedCollections = [
|
|||
'usersEmailDomains',
|
||||
]
|
||||
|
||||
exports.migrate = async () => {
|
||||
const migrate = async () => {
|
||||
for (const name of unusedCollections) {
|
||||
await Helpers.dropCollection(name)
|
||||
}
|
||||
}
|
||||
|
||||
exports.rollback = async () => {
|
||||
const rollback = async () => {
|
||||
// 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
|
||||
await db.splittests.updateMany(
|
||||
{},
|
||||
|
@ -28,7 +28,7 @@ exports.migrate = async client => {
|
|||
)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
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 = [
|
||||
{
|
||||
|
@ -11,12 +11,18 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
await Helpers.addIndexesToCollection(db.dropboxEntities, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
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 = [
|
||||
{
|
||||
|
@ -13,12 +13,18 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
await Helpers.addIndexesToCollection(db.dropboxProjects, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
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 = [
|
||||
{
|
||||
|
@ -13,12 +13,18 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
await Helpers.addIndexesToCollection(db.dropboxProjects, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
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 = [
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ const indexes = [
|
|||
{ key: { 'overleaf.userId': 1, 'dropbox.pathLower': 'hashed' } },
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
// Forcibly drop the dropboxEntities collection. The new structure is
|
||||
// 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)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
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 */
|
||||
|
||||
const Helpers = require('./lib/helpers')
|
||||
import Helpers from './lib/helpers.mjs'
|
||||
|
||||
exports.tags = ['saas']
|
||||
const tags = ['saas']
|
||||
|
||||
const indexes = [
|
||||
{
|
||||
|
@ -15,12 +15,18 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
await Helpers.addIndexesToCollection(db.users, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
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 = [
|
||||
{
|
||||
|
@ -13,16 +13,22 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
await Helpers.addIndexesToCollection(db.projectAuditLogEntries, indexes)
|
||||
await Helpers.addIndexesToCollection(db.userAuditLogEntries, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
await Promise.all([
|
||||
Helpers.dropIndexesFromCollection(db.userAuditLogEntries, 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 = [
|
||||
{
|
||||
|
@ -20,7 +20,7 @@ const userIndexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
await Helpers.addIndexesToCollection(
|
||||
db.projectAuditLogEntries,
|
||||
|
@ -29,7 +29,7 @@ exports.migrate = async client => {
|
|||
await Helpers.addIndexesToCollection(db.userAuditLogEntries, userIndexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
await Promise.all([
|
||||
Helpers.dropIndexesFromCollection(
|
||||
|
@ -39,3 +39,9 @@ exports.rollback = async client => {
|
|||
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 */
|
||||
|
||||
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 = [
|
||||
{
|
||||
|
@ -18,10 +18,16 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async ({ db }) => {
|
||||
const migrate = async ({ db }) => {
|
||||
await Helpers.addIndexesToCollection(db.projectHistoryChunks, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async ({ db }) => {
|
||||
const rollback = async ({ db }) => {
|
||||
await Helpers.dropIndexesFromCollection(db.projectHistoryChunks, indexes)
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
/* 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
|
||||
// 'recurly' -> 'recurlyStatus'
|
||||
await db.subscriptions.updateMany(
|
||||
|
@ -28,7 +28,7 @@ exports.migrate = async client => {
|
|||
)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
// 'recurlyStatus' -> 'recurly'
|
||||
await db.subscriptions.updateMany(
|
||||
|
@ -51,3 +51,9 @@ exports.rollback = async client => {
|
|||
{ $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 = {
|
||||
VERBOSE_LOGGING: 'true',
|
||||
BATCH_SIZE: '1',
|
||||
}
|
||||
|
||||
exports.migrate = async () => {
|
||||
const migrate = async () => {
|
||||
await batchedUpdate(
|
||||
'users',
|
||||
{ 'twoFactorAuthentication.secret': { $exists: true } },
|
||||
|
@ -18,7 +19,7 @@ exports.migrate = async () => {
|
|||
)
|
||||
}
|
||||
|
||||
exports.rollback = async () => {
|
||||
const rollback = async () => {
|
||||
await batchedUpdate(
|
||||
'users',
|
||||
{ 'twoFactorAuthentication.secretEncrypted': { $exists: true } },
|
||||
|
@ -28,3 +29,9 @@ exports.rollback = async () => {
|
|||
batchedUpdateOptions
|
||||
)
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
/* 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
|
||||
db.subscriptions.updateMany(
|
||||
{
|
||||
|
@ -36,6 +36,12 @@ exports.migrate = async client => {
|
|||
)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
// 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 = [
|
||||
{
|
||||
|
@ -15,10 +15,16 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async ({ db }) => {
|
||||
const migrate = async ({ db }) => {
|
||||
await Helpers.addIndexesToCollection(db.projectHistoryChunks, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async ({ db }) => {
|
||||
const rollback = async ({ db }) => {
|
||||
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 = {
|
||||
key: { refreshToken: 1 },
|
||||
|
@ -18,7 +18,7 @@ const TMP_INDEX = {
|
|||
name: 'refreshToken_tmp',
|
||||
}
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
// Create a temporary index so that the refresh tokens are not left unindexed
|
||||
// while we drop the index and recreate it.
|
||||
|
@ -32,7 +32,7 @@ exports.migrate = async client => {
|
|||
await Helpers.dropIndexesFromCollection(db.oauthAccessTokens, [TMP_INDEX])
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
// Create a temporary index so that the refresh tokens are not left unindexed
|
||||
// while we drop the index and recreate it.
|
||||
|
@ -45,3 +45,9 @@ exports.rollback = async client => {
|
|||
// Drop the temporary 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 = {
|
||||
name: 'expiresAt_1',
|
||||
|
@ -16,7 +16,7 @@ const AUTHORIZATION_CODES_INDEX = {
|
|||
expireAfterSeconds: 0,
|
||||
}
|
||||
|
||||
exports.migrate = async ({ db }) => {
|
||||
const migrate = async ({ db }) => {
|
||||
await Helpers.addIndexesToCollection(db.oauthAccessTokens, [
|
||||
ACCESS_TOKENS_INDEX,
|
||||
])
|
||||
|
@ -25,7 +25,7 @@ exports.migrate = async ({ db }) => {
|
|||
])
|
||||
}
|
||||
|
||||
exports.rollback = async ({ db }) => {
|
||||
const rollback = async ({ db }) => {
|
||||
await Helpers.dropIndexesFromCollection(db.oauthAccessTokens, [
|
||||
ACCESS_TOKENS_INDEX,
|
||||
])
|
||||
|
@ -33,3 +33,9 @@ exports.rollback = async ({ db }) => {
|
|||
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 = [
|
||||
{
|
||||
|
@ -10,12 +10,18 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
await Helpers.addIndexesToCollection(db.oauthAccessTokens, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
await Helpers.dropIndexesFromCollection(db.oauthAccessTokens, indexes)
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* 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 = [
|
||||
{
|
||||
|
@ -45,14 +45,20 @@ const newIndexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
await Helpers.addIndexesToCollection(db.projectHistoryChunks, newIndexes)
|
||||
await Helpers.dropIndexesFromCollection(db.projectHistoryChunks, oldIndexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
await Helpers.addIndexesToCollection(db.projectHistoryChunks, oldIndexes)
|
||||
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 = {
|
||||
key: { id: 1 },
|
||||
|
@ -20,7 +20,7 @@ const OAUTH_AUTHORIZATION_CODES_INDEX = {
|
|||
name: 'authorizationCode_1',
|
||||
}
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
await Helpers.addIndexesToCollection(db.oauthApplications, [
|
||||
OAUTH_APPLICATIONS_INDEX,
|
||||
|
@ -33,7 +33,7 @@ exports.migrate = async client => {
|
|||
])
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
await Helpers.dropIndexesFromCollection(db.oauthApplications, [
|
||||
OAUTH_APPLICATIONS_INDEX,
|
||||
|
@ -45,3 +45,9 @@ exports.rollback = async client => {
|
|||
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)
|
||||
|
||||
exports.tags = ['server-ce', 'server-pro']
|
||||
const tags = ['server-ce', 'server-pro']
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
const count = await db.projects.countDocuments({
|
||||
'overleaf.history.display': { $ne: true },
|
||||
|
@ -48,6 +49,12 @@ exports.migrate = async client => {
|
|||
}
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
// Not applicable
|
||||
}
|
||||
|
||||
export default {
|
||||
tags,
|
||||
migrate,
|
||||
rollback,
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
|
||||
const Helpers = require('./lib/helpers')
|
||||
import Helpers from './lib/helpers.mjs'
|
||||
|
||||
exports.tags = ['saas']
|
||||
const tags = ['saas']
|
||||
|
||||
const index = {
|
||||
key: {
|
||||
|
@ -11,12 +11,18 @@ const index = {
|
|||
name: 'featuresUpdatedAt_1',
|
||||
}
|
||||
|
||||
exports.migrate = async client => {
|
||||
const migrate = async client => {
|
||||
const { db } = client
|
||||
await Helpers.addIndexesToCollection(db.users, [index])
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
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,18 @@
|
|||
import runScript from '../modules/server-ce-scripts/scripts/upgrade-user-features.js'
|
||||
|
||||
const tags = ['server-ce', 'server-pro']
|
||||
|
||||
const migrate = async () => {
|
||||
// Run-time import as SaaS does not ship with the server-ce-scripts module
|
||||
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
|
||||
await db.subscriptions.updateMany(
|
||||
{ 'features.managedUsers': { $ne: true } },
|
||||
|
@ -8,10 +8,16 @@ exports.migrate = async client => {
|
|||
)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const rollback = async client => {
|
||||
const { db } = client
|
||||
await db.subscriptions.updateMany(
|
||||
{ 'features.managedUsers': { $eq: null } },
|
||||
{ $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 = [
|
||||
{
|
||||
|
@ -9,10 +9,16 @@ const indexes = [
|
|||
},
|
||||
]
|
||||
|
||||
exports.migrate = async ({ db }) => {
|
||||
const migrate = async ({ db }) => {
|
||||
await Helpers.dropIndexesFromCollection(db.projects, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async ({ db }) => {
|
||||
const rollback = async ({ db }) => {
|
||||
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
|
||||
await db.ssoConfigs.updateMany(
|
||||
{ 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
|
||||
await db.ssoConfigs.updateMany(
|
||||
{ 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