mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-21 21:06:00 +00:00
postgre, mysql analysers - refactor
This commit is contained in:
@@ -14,24 +14,26 @@ class MySqlAnalyser extends DatabaseAnalayser {
|
||||
res = res.replace('=[OBJECT_ID_CONDITION]', ' is not null');
|
||||
return res;
|
||||
}
|
||||
async runAnalysis() {
|
||||
async _runAnalysis() {
|
||||
const tables = await this.driver.query(this.pool, this.createQuery('tableModifications'));
|
||||
const columns = await this.driver.query(this.pool, this.createQuery('columns'));
|
||||
// const pkColumns = await this.driver.query(this.pool, this.createQuery('primary_keys.sql'));
|
||||
// const fkColumns = await this.driver.query(this.pool, this.createQuery('foreign_keys.sql'));
|
||||
|
||||
this.result.tables = tables.rows.map((table) => ({
|
||||
...table,
|
||||
columns: columns.rows
|
||||
.filter((col) => col.pureName == table.pureName && col.schemaName == table.schemaName)
|
||||
.map(({ isNullable, ...col }) => ({
|
||||
...col,
|
||||
notNull: !isNullable,
|
||||
})),
|
||||
foreignKeys: [],
|
||||
// primaryKey: extractPrimaryKeys(table, pkColumns.rows),
|
||||
// foreignKeys: extractForeignKeys(table, fkColumns.rows),
|
||||
}));
|
||||
return this.mergeAnalyseResult({
|
||||
tables: tables.rows.map((table) => ({
|
||||
...table,
|
||||
columns: columns.rows
|
||||
.filter((col) => col.pureName == table.pureName && col.schemaName == table.schemaName)
|
||||
.map(({ isNullable, ...col }) => ({
|
||||
...col,
|
||||
notNull: !isNullable,
|
||||
})),
|
||||
foreignKeys: [],
|
||||
// primaryKey: extractPrimaryKeys(table, pkColumns.rows),
|
||||
// foreignKeys: extractForeignKeys(table, fkColumns.rows),
|
||||
})),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user