mirror of
https://github.com/hcengineering/platform.git
synced 2026-10-01 14:05:05 +02:00
Backup restore support (#1878)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
@@ -26,14 +26,10 @@ import { generateToken } from '@anticrm/server-token'
|
||||
export async function connect (
|
||||
transactorUrl: string,
|
||||
workspace: string,
|
||||
reloadModel: boolean,
|
||||
email?: string
|
||||
email?: string,
|
||||
extra?: Record<string, string>
|
||||
): Promise<Client> {
|
||||
const token = generateToken(
|
||||
email ?? 'anticrm@hc.engineering',
|
||||
workspace,
|
||||
reloadModel ? { model: 'upgrade' } : undefined
|
||||
)
|
||||
const token = generateToken(email ?? 'anticrm@hc.engineering', workspace, extra)
|
||||
|
||||
// We need to override default factory with 'ws' one.
|
||||
// eslint-disable-next-line
|
||||
|
||||
@@ -97,7 +97,7 @@ export async function initModel (transactorUrl: string, dbName: string): Promise
|
||||
console.log(`${result.insertedCount} model transactions inserted.`)
|
||||
|
||||
console.log('creating data...')
|
||||
const connection = await connect(transactorUrl, dbName, true)
|
||||
const connection = await connect(transactorUrl, dbName, undefined, { model: 'upgrade' })
|
||||
try {
|
||||
for (const op of migrateOperations) {
|
||||
await op.upgrade(connection)
|
||||
@@ -156,7 +156,7 @@ export async function upgradeModel (transactorUrl: string, dbName: string): Prom
|
||||
|
||||
console.log('Apply upgrade operations')
|
||||
|
||||
const connection = await connect(transactorUrl, dbName, true)
|
||||
const connection = await connect(transactorUrl, dbName, undefined, { model: 'upgrade' })
|
||||
|
||||
// Create update indexes
|
||||
await createUpdateIndexes(connection, db)
|
||||
|
||||
Reference in New Issue
Block a user