1
0
mirror of https://github.com/lana-k/sqliteviz.git synced 2025-12-06 18:18:53 +08:00

line size lint checking

This commit is contained in:
lana-k
2021-08-29 21:27:02 +02:00
parent e38f482933
commit 0336168bdc
36 changed files with 434 additions and 75 deletions

View File

@@ -80,11 +80,17 @@ class Database {
async refreshSchema () {
const getSchemaSql = `
WITH columns as (SELECT a.tbl_name, json_group_array(json_object('name', b.name,'type', IIF(b.type = '', 'N/A', b.type))) as column_json
FROM sqlite_master a, pragma_table_info(a.name) b
WHERE a.type in ('table','view') AND a.name NOT LIKE 'sqlite_%' group by tbl_name
WITH columns as (
SELECT
a.tbl_name,
json_group_array(
json_object('name', b.name,'type', IIF(b.type = '', 'N/A', b.type))
) as column_json
FROM sqlite_master a, pragma_table_info(a.name) b
WHERE a.type in ('table','view') AND a.name NOT LIKE 'sqlite_%' group by tbl_name
)
SELECT json_group_array(json_object('name',tbl_name, 'columns', json(column_json))) objects from columns;
SELECT json_group_array(json_object('name',tbl_name, 'columns', json(column_json))) objects
FROM columns;
`
const result = await this.execute(getSchemaSql)
this.schema = JSON.parse(result.values.objects[0])