import-export - work with schema (mssql)

This commit is contained in:
Jan Prochazka
2020-06-18 09:38:08 +02:00
parent 759754c437
commit a9ce93cd67
11 changed files with 73 additions and 23 deletions

View File

@@ -168,7 +168,7 @@ class MsSqlAnalyser extends DatabaseAnalyser {
if (this.singleObjectFilter) {
const { typeField } = this.singleObjectFilter;
if (!this.singleObjectId) return null;
if (!filterIdObjects.includes(typeField)) return null;
if (!filterIdObjects || !filterIdObjects.includes(typeField)) return null;
return res.replace('=[OBJECT_ID_CONDITION]', ` = ${this.singleObjectId}`);
}
if (!this.modifications || !filterIdObjects || this.modifications.length == 0) {
@@ -202,6 +202,9 @@ class MsSqlAnalyser extends DatabaseAnalyser {
const columnsRows = await this.driver.query(this.pool, this.createQuery('columns', ['tables']));
const pkColumnsRows = await this.driver.query(this.pool, this.createQuery('primaryKeys', ['tables']));
const fkColumnsRows = await this.driver.query(this.pool, this.createQuery('foreignKeys', ['tables']));
const schemaRows = await this.driver.query(this.pool, this.createQuery('getSchemas'));
const schemas = schemaRows.rows;
const sqlCodeRows = await this.driver.query(
this.pool,
@@ -265,6 +268,7 @@ class MsSqlAnalyser extends DatabaseAnalyser {
views,
procedures,
functions,
schemas,
});
}

View File

@@ -0,0 +1 @@
module.exports = `select schema_id as objectId, name as schemaName from sys.schemas`;

View File

@@ -7,6 +7,7 @@ const loadSqlCode = require('./loadSqlCode');
const views = require('./views');
const programmables = require('./programmables');
const viewColumns = require('./viewColumns');
const getSchemas = require('./getSchemas');
module.exports = {
columns,
@@ -18,4 +19,5 @@ module.exports = {
views,
programmables,
viewColumns,
getSchemas,
};