mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-23 21:56:00 +00:00
mssql - incremental analysis
This commit is contained in:
@@ -9,29 +9,22 @@ class MySqlAnalyser extends DatabaseAnalayser {
|
||||
super(pool, driver);
|
||||
}
|
||||
|
||||
async createQuery(
|
||||
resFileName,
|
||||
tables = false,
|
||||
views = false,
|
||||
procedures = false,
|
||||
functions = false,
|
||||
triggers = false
|
||||
) {
|
||||
createQuery(resFileName, tables = false, views = false, procedures = false, functions = false, triggers = false) {
|
||||
let res = sql[resFileName];
|
||||
res = res.replace('=[OBJECT_NAME_CONDITION]', ' is not null');
|
||||
res = res.replace('#DATABASE#', this.pool._database_name);
|
||||
return res;
|
||||
}
|
||||
async runAnalysis() {
|
||||
const tables = await this.driver.query(this.pool, await this.createQuery('tables'));
|
||||
const columns = await this.driver.query(this.pool, await this.createQuery('columns'));
|
||||
// const pkColumns = await this.driver.query(this.pool, await this.createQuery('primary_keys.sql'));
|
||||
// const fkColumns = await this.driver.query(this.pool, await this.createQuery('foreign_keys.sql'));
|
||||
const tables = await this.driver.query(this.pool, this.createQuery('tables'));
|
||||
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 => ({
|
||||
this.result.tables = tables.rows.map((table) => ({
|
||||
...table,
|
||||
columns: columns.rows
|
||||
.filter(col => col.pureName == table.pureName)
|
||||
.filter((col) => col.pureName == table.pureName)
|
||||
.map(({ isNullable, extra, ...col }) => ({
|
||||
...col,
|
||||
notNull: !isNullable,
|
||||
|
||||
Reference in New Issue
Block a user