mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 05:36:00 +00:00
schemaList moved from dbinfo to separate request
This commit is contained in:
@@ -312,17 +312,6 @@ class Analyser extends DatabaseAnalyser {
|
||||
return res;
|
||||
}
|
||||
|
||||
async readSchemaList() {
|
||||
const schemaRows = await this.analyserQuery('getSchemas');
|
||||
|
||||
const schemas = schemaRows.rows.map(x => ({
|
||||
schemaName: x.schema_name,
|
||||
objectId: `schemas:${x.schema_name}`,
|
||||
}));
|
||||
|
||||
return schemas;
|
||||
}
|
||||
|
||||
async _getFastSnapshot() {
|
||||
const tableModificationsQueryData = this.driver.dialect.stringAgg
|
||||
? await this.analyserQuery('tableModifications')
|
||||
|
||||
@@ -4,7 +4,7 @@ const stream = require('stream');
|
||||
const driverBases = require('../frontend/drivers');
|
||||
const Analyser = require('./Analyser');
|
||||
const pg = require('pg');
|
||||
const { getLogger, createBulkInsertStreamBase, makeUniqueColumnNames } = global.DBGATE_PACKAGES['dbgate-tools'];;
|
||||
const { getLogger, createBulkInsertStreamBase, makeUniqueColumnNames } = global.DBGATE_PACKAGES['dbgate-tools'];
|
||||
|
||||
const logger = getLogger('postreDriver');
|
||||
|
||||
@@ -267,6 +267,20 @@ const drivers = driverBases.map(driverBase => ({
|
||||
},
|
||||
];
|
||||
},
|
||||
|
||||
async listSchemas(pool) {
|
||||
const schemaRows = await this.query(
|
||||
pool,
|
||||
'select oid as "object_id", nspname as "schema_name" from pg_catalog.pg_namespace'
|
||||
);
|
||||
|
||||
const schemas = schemaRows.rows.map(x => ({
|
||||
schemaName: x.schema_name,
|
||||
objectId: x.object_id,
|
||||
}));
|
||||
|
||||
return schemas;
|
||||
},
|
||||
}));
|
||||
|
||||
module.exports = drivers;
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
module.exports = `select oid as "object_id", nspname as "schema_name" from pg_catalog.pg_namespace`;
|
||||
@@ -12,7 +12,6 @@ const matviewColumns = require('./matviewColumns');
|
||||
const indexes = require('./indexes');
|
||||
const indexcols = require('./indexcols');
|
||||
const uniqueNames = require('./uniqueNames');
|
||||
const getSchemas = require('./getSchemas');
|
||||
const geometryColumns = require('./geometryColumns');
|
||||
const geographyColumns = require('./geographyColumns');
|
||||
|
||||
@@ -40,5 +39,4 @@ module.exports = {
|
||||
uniqueNames,
|
||||
geometryColumns,
|
||||
geographyColumns,
|
||||
getSchemas,
|
||||
};
|
||||
|
||||
@@ -136,7 +136,9 @@ const postgresDriverBase = {
|
||||
}
|
||||
|
||||
return (
|
||||
['authType', 'user', 'password', 'defaultDatabase', 'singleDatabase', 'isReadOnly'].includes(field) ||
|
||||
['authType', 'user', 'password', 'defaultDatabase', 'singleDatabase', 'isReadOnly', 'useSeparateSchemas'].includes(
|
||||
field
|
||||
) ||
|
||||
(values.authType == 'socket' && ['socketPath'].includes(field)) ||
|
||||
(values.authType != 'socket' && ['server', 'port'].includes(field))
|
||||
);
|
||||
@@ -242,7 +244,8 @@ const redshiftDriver = {
|
||||
title: 'Amazon Redshift',
|
||||
defaultPort: 5439,
|
||||
databaseUrlPlaceholder: 'e.g. redshift-cluster-1.xxxx.redshift.amazonaws.com:5439/dev',
|
||||
showConnectionField: (field, values) => ['databaseUrl', 'user', 'password', 'isReadOnly'].includes(field),
|
||||
showConnectionField: (field, values) =>
|
||||
['databaseUrl', 'user', 'password', 'isReadOnly', 'useSeparateSchemas'].includes(field),
|
||||
beforeConnectionSave: connection => {
|
||||
const { databaseUrl } = connection;
|
||||
if (databaseUrl) {
|
||||
|
||||
Reference in New Issue
Block a user