diff --git a/packages/api/src/controllers/plugins.js b/packages/api/src/controllers/plugins.js index 2d671eba..ab538b8f 100644 --- a/packages/api/src/controllers/plugins.js +++ b/packages/api/src/controllers/plugins.js @@ -139,6 +139,7 @@ module.exports = { } for (const packageName of preinstallPlugins) { if (this.removedPlugins.includes(packageName)) continue; + if (installed.find((x) => x.name == packageName)) continue; try { console.log('Preinstalling plugin', packageName); await this.install({ packageName }); diff --git a/packages/api/src/shell/tableReader.js b/packages/api/src/shell/tableReader.js index 54a09b51..7eb407a3 100644 --- a/packages/api/src/shell/tableReader.js +++ b/packages/api/src/shell/tableReader.js @@ -1,4 +1,4 @@ -const { quoteFullName } = require('dbgate-tools'); +const { quoteFullName, fullNameToString } = require('dbgate-tools'); const requireEngineDriver = require('../utility/requireEngineDriver'); async function tableReader({ connection, pureName, schemaName }) { @@ -11,13 +11,15 @@ async function tableReader({ connection, pureName, schemaName }) { const table = await driver.analyseSingleObject(pool, fullName, 'tables'); const query = `select * from ${quoteFullName(driver.dialect, fullName)}`; if (table) { - console.log(`Reading table ${table.pureName}`); + // @ts-ignore + console.log(`Reading table ${fullNameToString(table)}`); // @ts-ignore return await driver.readQuery(pool, query, table); } const view = await driver.analyseSingleObject(pool, fullName, 'views'); if (view) { - console.log(`Reading view ${view.pureName}`); + // @ts-ignore + console.log(`Reading view ${fullNameToString(view)}`); // @ts-ignore return await driver.readQuery(pool, query, view); } diff --git a/packages/api/src/shell/tableWriter.js b/packages/api/src/shell/tableWriter.js index f59e3e4c..69965591 100644 --- a/packages/api/src/shell/tableWriter.js +++ b/packages/api/src/shell/tableWriter.js @@ -1,7 +1,8 @@ -const requireEngineDriver = require("../utility/requireEngineDriver"); +const { fullNameToString } = require('dbgate-tools'); +const requireEngineDriver = require('../utility/requireEngineDriver'); async function tableWriter({ connection, schemaName, pureName, ...options }) { - console.log(`Write table ${schemaName}.${pureName}`); + console.log(`Writing table ${fullNameToString({ schemaName, pureName })}`); const driver = requireEngineDriver(connection); const pool = await driver.connect(connection); diff --git a/packages/tools/src/createBulkInsertStreamBase.ts b/packages/tools/src/createBulkInsertStreamBase.ts index f8bb53a9..d9bae626 100644 --- a/packages/tools/src/createBulkInsertStreamBase.ts +++ b/packages/tools/src/createBulkInsertStreamBase.ts @@ -43,7 +43,7 @@ export function createBulkInsertStreamBase(driver, stream, pool, name, options): await driver.query(pool, `TRUNCATE TABLE ${fullNameQuoted}`); } - this.columnNames = _intersection( + writable.columnNames = _intersection( structure.columns.map((x) => x.columnName), writable.structure.columns.map((x) => x.columnName) ); @@ -56,14 +56,14 @@ export function createBulkInsertStreamBase(driver, stream, pool, name, options): const dmp = driver.createDumper(); dmp.putRaw(`INSERT INTO ${fullNameQuoted} (`); - dmp.putCollection(',', this.columnNames, (col) => dmp.putRaw(driver.dialect.quoteIdentifier(col))); + dmp.putCollection(',', writable.columnNames, (col) => dmp.putRaw(driver.dialect.quoteIdentifier(col))); dmp.putRaw(')\n VALUES\n'); let wasRow = false; for (const row of rows) { if (wasRow) dmp.putRaw(',\n'); dmp.putRaw('('); - dmp.putCollection(',', this.columnNames, (col) => dmp.putValue(row[col])); + dmp.putCollection(',', writable.columnNames, (col) => dmp.putValue(row[col])); dmp.putRaw(')'); wasRow = true; } diff --git a/packages/web/src/utility/globalState.js b/packages/web/src/utility/globalState.js index 51ede590..d47c4666 100644 --- a/packages/web/src/utility/globalState.js +++ b/packages/web/src/utility/globalState.js @@ -104,6 +104,7 @@ export function useAppObjectParams() { setOpenedConnections, config, showModal, + extensions, }; }