mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-28 00:16:24 +00:00
backend bundle refactor
This commit is contained in:
@@ -1,16 +1,9 @@
|
||||
const fp = require("lodash/fp");
|
||||
const _ = require("lodash");
|
||||
const sql = require('./sql')
|
||||
|
||||
const DatabaseAnalayser = require("../default/DatabaseAnalyser");
|
||||
|
||||
/** @returns {Promise<string>} */
|
||||
async function loadQuery(pool, name) {
|
||||
return await pool._nativeModules.fs.readFile(
|
||||
pool._nativeModules.path.join(__dirname, name),
|
||||
"utf-8"
|
||||
);
|
||||
}
|
||||
|
||||
class MySqlAnalyser extends DatabaseAnalayser {
|
||||
constructor(pool, driver) {
|
||||
super(pool, driver);
|
||||
@@ -24,18 +17,18 @@ class MySqlAnalyser extends DatabaseAnalayser {
|
||||
functions = false,
|
||||
triggers = false
|
||||
) {
|
||||
let res = await loadQuery(this.pool, resFileName);
|
||||
let res = sql[resFileName];
|
||||
res = res.replace("=[OBJECT_ID_CONDITION]", " is not null");
|
||||
return res;
|
||||
}
|
||||
async runAnalysis() {
|
||||
const tables = await this.driver.query(
|
||||
this.pool,
|
||||
await this.createQuery("table_modifications.psql")
|
||||
await this.createQuery("tableModifications")
|
||||
);
|
||||
const columns = await this.driver.query(
|
||||
this.pool,
|
||||
await this.createQuery("columns.psql")
|
||||
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'));
|
||||
|
||||
Reference in New Issue
Block a user