not connected deploy test

This commit is contained in:
Jan Prochazka
2024-10-01 10:37:05 +02:00
parent 87aa60bc3e
commit 3ec7f651c1
5 changed files with 74 additions and 10 deletions

View File

@@ -8,10 +8,14 @@ async function executeQuery({ connection = undefined, systemConnection = undefin
logger.info({ sql }, `Execute query`);
if (!driver) driver = requireEngineDriver(connection);
const pool = systemConnection || (await connectUtility(driver, connection, 'script'));
const dbhan = systemConnection || (await connectUtility(driver, connection, 'script'));
logger.info(`Connected.`);
await driver.script(pool, sql);
await driver.script(dbhan, sql);
if (!systemConnection) {
await driver.close(dbhan);
}
}
module.exports = executeQuery;

View File

@@ -21,9 +21,9 @@ async function generateDeploySql({
}) {
if (!driver) driver = requireEngineDriver(connection);
const pool = systemConnection || (await connectUtility(driver, connection, 'read'));
const dbhan = systemConnection || (await connectUtility(driver, connection, 'read'));
if (!analysedStructure) {
analysedStructure = await driver.analyseFull(pool);
analysedStructure = await driver.analyseFull(dbhan);
}
const deployedModel = generateDbPairingId(
@@ -41,7 +41,7 @@ async function generateDeploySql({
noRenameColumn: true,
};
const currentModelPaired = matchPairedObjects(deployedModel, currentModel, opts);
const currentModelPairedPreloaded = await enrichWithPreloadedRows(deployedModel, currentModelPaired, pool, driver);
const currentModelPairedPreloaded = await enrichWithPreloadedRows(deployedModel, currentModelPaired, dbhan, driver);
// console.log('currentModelPairedPreloaded', currentModelPairedPreloaded.tables[0]);
// console.log('deployedModel', deployedModel.tables[0]);
@@ -55,6 +55,10 @@ async function generateDeploySql({
deployedModel,
driver
);
if (!systemConnection) {
await driver.close(dbhan);
}
return res;
}