From dacea7812361326c555c560ad65eca2649f8fcec Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Sun, 23 May 2021 19:57:24 +0200 Subject: [PATCH] sqlite incremental model update --- .../src/backend/Analyser.js | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/plugins/dbgate-plugin-sqlite/src/backend/Analyser.js b/plugins/dbgate-plugin-sqlite/src/backend/Analyser.js index c118525c8..6d376cbe6 100644 --- a/plugins/dbgate-plugin-sqlite/src/backend/Analyser.js +++ b/plugins/dbgate-plugin-sqlite/src/backend/Analyser.js @@ -6,6 +6,27 @@ class Analyser extends DatabaseAnalyser { super(pool, driver); } + async _getFastSnapshot() { + const objects = await this.driver.query(this.pool, "select * from sqlite_master where type='table' or type='view'"); + + return { + tables: objects.rows + .filter((x) => x.type == 'table') + .map((x) => ({ + pureName: x.name, + objectId: x.name, + contentHash: x.sql, + })), + views: objects.rows + .filter((x) => x.type == 'view') + .map((x) => ({ + pureName: x.name, + objectId: x.name, + contentHash: x.sql, + })), + }; + } + async _runAnalysis() { const objects = await this.driver.query(this.pool, "select * from sqlite_master where type='table' or type='view'"); const tables = objects.rows.filter((x) => x.type == 'table');