mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-26 00:45:58 +00:00
sqlgen
This commit is contained in:
@@ -11,9 +11,9 @@ module.exports = {
|
|||||||
const structure = await databaseConnections.structure({ conid, database })
|
const structure = await databaseConnections.structure({ conid, database })
|
||||||
const connection = await connections.get({ conid })
|
const connection = await connections.get({ conid })
|
||||||
const driver = requireEngineDriver(connection);
|
const driver = requireEngineDriver(connection);
|
||||||
const dmp = driver.createDumper()
|
const dmp = driver.createDumper();
|
||||||
const generator = new SqlGenerator(structure, options, objects, dmp);
|
const generator = new SqlGenerator(structure, options, objects, dmp);
|
||||||
generator.dump();
|
await generator.dump();
|
||||||
return dmp.s;
|
return dmp.s;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export class SqlGenerator {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
dump() {
|
async dump() {
|
||||||
if (this.options.createTables) {
|
if (this.options.createTables) {
|
||||||
for (const table of this.tables) {
|
for (const table of this.tables) {
|
||||||
this.dmp.createTable(table);
|
this.dmp.createTable(table);
|
||||||
|
|||||||
@@ -53,10 +53,12 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
async function generatePreview(options, objects) {
|
async function generatePreview(options, objects) {
|
||||||
|
busy = true;
|
||||||
const response = await axiosInstance.post('sqlgen/preview', { conid, database, objects, options });
|
const response = await axiosInstance.post('sqlgen/preview', { conid, database, objects, options });
|
||||||
if (_.isString(response.data)) {
|
if (_.isString(response.data)) {
|
||||||
sqlPreview = response.data;
|
sqlPreview = response.data;
|
||||||
}
|
}
|
||||||
|
busy = false;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user