mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-02 12:33:58 +00:00
data duplicator - folder settings
This commit is contained in:
@@ -12,6 +12,7 @@ const { resolveArchiveFolder } = require('../utility/directories');
|
|||||||
async function dataDuplicator({
|
async function dataDuplicator({
|
||||||
connection,
|
connection,
|
||||||
archive,
|
archive,
|
||||||
|
folder,
|
||||||
items,
|
items,
|
||||||
options,
|
options,
|
||||||
analysedStructure = null,
|
analysedStructure = null,
|
||||||
@@ -19,7 +20,7 @@ async function dataDuplicator({
|
|||||||
systemConnection,
|
systemConnection,
|
||||||
}) {
|
}) {
|
||||||
if (!driver) driver = requireEngineDriver(connection);
|
if (!driver) driver = requireEngineDriver(connection);
|
||||||
|
|
||||||
const dbhan = systemConnection || (await connectUtility(driver, connection, 'write'));
|
const dbhan = systemConnection || (await connectUtility(driver, connection, 'write'));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -29,6 +30,12 @@ async function dataDuplicator({
|
|||||||
analysedStructure = await driver.analyseFull(dbhan);
|
analysedStructure = await driver.analyseFull(dbhan);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const sourceDir = archive
|
||||||
|
? resolveArchiveFolder(archive)
|
||||||
|
: folder?.startsWith('archive:')
|
||||||
|
? resolveArchiveFolder(folder.substring('archive:'.length))
|
||||||
|
: folder;
|
||||||
|
|
||||||
const dupl = new DataDuplicator(
|
const dupl = new DataDuplicator(
|
||||||
dbhan,
|
dbhan,
|
||||||
driver,
|
driver,
|
||||||
@@ -38,8 +45,7 @@ async function dataDuplicator({
|
|||||||
operation: item.operation,
|
operation: item.operation,
|
||||||
matchColumns: item.matchColumns,
|
matchColumns: item.matchColumns,
|
||||||
openStream:
|
openStream:
|
||||||
item.openStream ||
|
item.openStream || (() => jsonLinesReader({ fileName: path.join(sourceDir, `${item.name}.jsonl`) })),
|
||||||
(() => jsonLinesReader({ fileName: path.join(resolveArchiveFolder(archive), `${item.name}.jsonl`) })),
|
|
||||||
})),
|
})),
|
||||||
stream,
|
stream,
|
||||||
copyStream,
|
copyStream,
|
||||||
|
|||||||
Reference in New Issue
Block a user