mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
sqlite incremental analysis recognizes indexes
This commit is contained in:
parent
1b853dd3b3
commit
02aa94afc9
@ -12,7 +12,7 @@ SELECT
|
|||||||
pragma_index_list(m.name) AS il,
|
pragma_index_list(m.name) AS il,
|
||||||
pragma_index_info(il.name) AS ii
|
pragma_index_info(il.name) AS ii
|
||||||
WHERE m.type='table' AND il.origin <> 'pk'
|
WHERE m.type='table' AND il.origin <> 'pk'
|
||||||
ORDER BY ii.seqno
|
ORDER BY ii.seqno, il.name
|
||||||
`;
|
`;
|
||||||
|
|
||||||
class Analyser extends DatabaseAnalyser {
|
class Analyser extends DatabaseAnalyser {
|
||||||
@ -22,6 +22,7 @@ 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.pool, "select * from sqlite_master where type='table' or type='view'");
|
||||||
|
const indexcols = await this.driver.query(this.pool, indexcolsQuery);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
tables: objects.rows
|
tables: objects.rows
|
||||||
@ -29,7 +30,12 @@ class Analyser extends DatabaseAnalyser {
|
|||||||
.map((x) => ({
|
.map((x) => ({
|
||||||
pureName: x.name,
|
pureName: x.name,
|
||||||
objectId: x.name,
|
objectId: x.name,
|
||||||
contentHash: x.sql,
|
contentHash: [
|
||||||
|
x.sql,
|
||||||
|
...indexcols.rows
|
||||||
|
.filter((y) => y.tableName == x.name)
|
||||||
|
.map((y) => `-- ${y.constraintName}: ${y.columnName}`),
|
||||||
|
].join(';\n'),
|
||||||
})),
|
})),
|
||||||
views: objects.rows
|
views: objects.rows
|
||||||
.filter((x) => x.type == 'view')
|
.filter((x) => x.type == 'view')
|
||||||
|
Loading…
Reference in New Issue
Block a user