fixed SQLite

This commit is contained in:
SPRINX0\prochazka
2024-09-20 10:47:51 +02:00
parent 780d187911
commit f34d0cbb90
2 changed files with 9 additions and 9 deletions

View File

@@ -118,7 +118,7 @@ const engines = [
engine: 'sqlite@dbgate-plugin-sqlite', engine: 'sqlite@dbgate-plugin-sqlite',
}, },
objects: [views], objects: [views],
skipOnCI: true, skipOnCI: false,
}, },
{ {
label: 'CockroachDB', label: 'CockroachDB',

View File

@@ -16,8 +16,8 @@ SELECT
`; `;
class Analyser extends DatabaseAnalyser { class Analyser extends DatabaseAnalyser {
constructor(pool, driver, version) { constructor(dbhan, driver, version) {
super(pool, driver, version); super(dbhan, driver, version);
} }
async _computeSingleObjectId() { async _computeSingleObjectId() {
@@ -26,8 +26,8 @@ class Analyser extends DatabaseAnalyser {
} }
async _getFastSnapshot() { async _getFastSnapshot() {
const objects = await this.driver.query(this.pool, "select * from sqlite_master where type='table' or type='view'"); const objects = await this.driver.query(this.dbhan, "select * from sqlite_master where type='table' or type='view'");
const indexcols = await this.driver.query(this.pool, indexcolsQuery); const indexcols = await this.driver.query(this.dbhan, indexcolsQuery);
return { return {
tables: objects.rows tables: objects.rows
@@ -79,7 +79,7 @@ class Analyser extends DatabaseAnalyser {
createSql: x.sql, createSql: x.sql,
})); }));
const indexcols = await this.driver.query(this.pool, indexcolsQuery); const indexcols = await this.driver.query(this.dbhan, indexcolsQuery);
for (const tableName of this.getRequestedObjectPureNames( for (const tableName of this.getRequestedObjectPureNames(
'tables', 'tables',
@@ -88,7 +88,7 @@ class Analyser extends DatabaseAnalyser {
const tableObj = tableList.find((x) => x.pureName == tableName); const tableObj = tableList.find((x) => x.pureName == tableName);
if (!tableObj) continue; if (!tableObj) continue;
const info = await this.driver.query(this.pool, `pragma table_info('${tableName}')`); const info = await this.driver.query(this.dbhan, `pragma table_info('${tableName}')`);
tableObj.columns = info.rows.map((col) => ({ tableObj.columns = info.rows.map((col) => ({
columnName: col.name, columnName: col.name,
dataType: col.type, dataType: col.type,
@@ -132,7 +132,7 @@ class Analyser extends DatabaseAnalyser {
}; };
} }
const fklist = await this.driver.query(this.pool, `pragma foreign_key_list('${tableName}')`); const fklist = await this.driver.query(this.dbhan, `pragma foreign_key_list('${tableName}')`);
tableObj.foreignKeys = _.values(_.groupBy(fklist.rows, 'id')).map((fkcols) => { tableObj.foreignKeys = _.values(_.groupBy(fklist.rows, 'id')).map((fkcols) => {
const fkcol = fkcols[0]; const fkcol = fkcols[0];
const fk = { const fk = {
@@ -157,7 +157,7 @@ class Analyser extends DatabaseAnalyser {
const viewObj = viewList.find((x) => x.pureName == viewName); const viewObj = viewList.find((x) => x.pureName == viewName);
if (!viewObj) continue; if (!viewObj) continue;
const info = await this.driver.query(this.pool, `pragma table_info('${viewName}')`); const info = await this.driver.query(this.dbhan, `pragma table_info('${viewName}')`);
viewObj.columns = info.rows.map((col) => ({ viewObj.columns = info.rows.map((col) => ({
columnName: col.name, columnName: col.name,
dataType: col.type, dataType: col.type,