mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-21 17:17:54 +02:00
Extract postgres base package (#9397)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
+6
-7
@@ -37,7 +37,6 @@ import {
|
||||
} from '@hcengineering/postgres'
|
||||
import { type DBDoc } from '@hcengineering/postgres/types/utils'
|
||||
import { getTransactorEndpoint } from '@hcengineering/server-client'
|
||||
import { sharedPipelineContextVars } from '@hcengineering/server-pipeline'
|
||||
import { generateToken } from '@hcengineering/server-token'
|
||||
import { connect } from '@hcengineering/server-tool'
|
||||
import { type MongoClient } from 'mongodb'
|
||||
@@ -57,7 +56,7 @@ export async function moveFromMongoToPG (
|
||||
}
|
||||
const client = getMongoClient(mongoUrl)
|
||||
const mongo = await client.getClient()
|
||||
const pg = getDBClient(sharedPipelineContextVars, dbUrl)
|
||||
const pg = getDBClient(dbUrl)
|
||||
const pgClient = await pg.getClient()
|
||||
|
||||
for (let index = 0; index < workspaces.length; index++) {
|
||||
@@ -181,7 +180,7 @@ export async function moveWorkspaceFromMongoToPG (
|
||||
}
|
||||
const client = getMongoClient(mongoUrl)
|
||||
const mongo = await client.getClient()
|
||||
const pg = getDBClient(sharedPipelineContextVars, dbUrl)
|
||||
const pg = getDBClient(dbUrl)
|
||||
const pgClient = await pg.getClient()
|
||||
|
||||
await moveWorkspace(accountDb, mongo, pgClient, ws, region, include, force)
|
||||
@@ -530,7 +529,7 @@ export async function migrateCreatedModifiedBy (
|
||||
progressMade = false
|
||||
connectsCount++
|
||||
|
||||
pg = getDBClient(sharedPipelineContextVars, dbUrl)
|
||||
pg = getDBClient(dbUrl)
|
||||
pgClient = await pg.getClient()
|
||||
|
||||
// Expect temp table with mapping to be created manually
|
||||
@@ -907,7 +906,7 @@ export async function migrateMergedAccounts (
|
||||
throw new Error('Only CockroachDB is supported')
|
||||
}
|
||||
|
||||
const pg = getDBClient(sharedPipelineContextVars, dbUrl)
|
||||
const pg = getDBClient(dbUrl)
|
||||
const pgClient = await pg.getClient()
|
||||
const token = getToolToken()
|
||||
|
||||
@@ -1020,7 +1019,7 @@ export async function filterMergedAccountsInMembers (
|
||||
throw new Error('Only CockroachDB is supported')
|
||||
}
|
||||
|
||||
const pg = getDBClient(sharedPipelineContextVars, dbUrl)
|
||||
const pg = getDBClient(dbUrl)
|
||||
const pgClient = await pg.getClient()
|
||||
|
||||
try {
|
||||
@@ -1083,7 +1082,7 @@ export async function ensureGlobalPersonsForLocalAccounts (
|
||||
throw new Error('Only CockroachDB is supported')
|
||||
}
|
||||
|
||||
const pg = getDBClient(sharedPipelineContextVars, dbUrl)
|
||||
const pg = getDBClient(dbUrl)
|
||||
const pgClient = await pg.getClient()
|
||||
const token = getToolToken()
|
||||
|
||||
|
||||
@@ -44,8 +44,7 @@ import {
|
||||
registerServerPlugins,
|
||||
registerStringLoaders,
|
||||
registerTxAdapterFactory,
|
||||
setAdapterSecurity,
|
||||
sharedPipelineContextVars
|
||||
setAdapterSecurity
|
||||
} from '@hcengineering/server-pipeline'
|
||||
import serverToken, { generateToken } from '@hcengineering/server-token'
|
||||
import { createWorkspace, upgradeWorkspace } from '@hcengineering/workspace-service'
|
||||
@@ -134,10 +133,10 @@ const colorConstants = {
|
||||
|
||||
// Register close on process exit.
|
||||
process.on('exit', () => {
|
||||
shutdownPostgres(sharedPipelineContextVars).catch((err) => {
|
||||
shutdownPostgres().catch((err) => {
|
||||
console.error(err)
|
||||
})
|
||||
shutdownMongo(sharedPipelineContextVars).catch((err) => {
|
||||
shutdownMongo().catch((err) => {
|
||||
console.error(err)
|
||||
})
|
||||
})
|
||||
@@ -663,7 +662,6 @@ export function devTool (
|
||||
// },
|
||||
// cmd.region,
|
||||
// 5000, // 5 gigabytes per blob
|
||||
// sharedPipelineContextVars,
|
||||
// async (storage, workspaceStorage) => {
|
||||
// if (cmd.remove) {
|
||||
// await updateArchiveInfo(toolCtx, db, ws.workspace, true)
|
||||
@@ -783,7 +781,6 @@ export function devTool (
|
||||
// },
|
||||
// cmd.region,
|
||||
// 100,
|
||||
// sharedPipelineContextVars
|
||||
// )
|
||||
// ) {
|
||||
// processed++
|
||||
|
||||
@@ -55,11 +55,7 @@ import { getDBClient } from '@hcengineering/postgres'
|
||||
import { withRetry } from '@hcengineering/retry'
|
||||
import { getAccountClient } from '@hcengineering/server-client'
|
||||
import { type PipelineFactory, type StorageAdapter, createDummyStorageAdapter } from '@hcengineering/server-core'
|
||||
import {
|
||||
createBackupPipeline,
|
||||
createEmptyBroadcastOps,
|
||||
sharedPipelineContextVars
|
||||
} from '@hcengineering/server-pipeline'
|
||||
import { createBackupPipeline, createEmptyBroadcastOps } from '@hcengineering/server-pipeline'
|
||||
import { generateToken } from '@hcengineering/server-token'
|
||||
import { isEmptyMarkup } from '@hcengineering/text-core'
|
||||
|
||||
@@ -396,7 +392,7 @@ export async function restoreMarkupRefs (
|
||||
usePassedCtx: true
|
||||
})
|
||||
|
||||
const pg = getDBClient(sharedPipelineContextVars, dbUrl)
|
||||
const pg = getDBClient(dbUrl)
|
||||
const pgClient = await pg.getClient()
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user