sql console added to global menu and now has schema info

This commit is contained in:
zadam
2019-02-10 10:38:18 +01:00
parent e04f1cd574
commit 92fcd7b345
26 changed files with 86 additions and 22387 deletions

View File

@@ -2,6 +2,20 @@
const sql = require('../../services/sql');
async function getSchema() {
const tableNames = await sql.getColumn(`SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%' ORDER BY name`);
const tables = [];
for (const tableName of tableNames) {
tables.push({
name: tableName,
columns: await sql.getRows(`PRAGMA table_info(${tableName})`)
});
}
return tables;
}
async function execute(req) {
const query = req.body.query;
@@ -20,5 +34,6 @@ async function execute(req) {
}
module.exports = {
getSchema,
execute
};