Query History: Use a search index on new queries to filter in mixed data sources (#88979)

* Add search index table

* Stab a test

* Add more tests

* Add basic index

* Switch to UID and add a test for the index

* Improve tests coverage

* Remove redundant whitespaces

* Load all data source APIs when query history is loaded

* Fix column type

* Fix migration

* Clean-up the index

* Fix linting

* Fix migrations

* Fix migrations

* Fix migrations

* Rename index to details
This commit is contained in:
Piotr Jamróz
2024-07-16 11:47:21 +02:00
committed by GitHub
parent 6d9b8225aa
commit 6750e881e3
9 changed files with 280 additions and 32 deletions
@@ -29,4 +29,14 @@ func addQueryHistoryMigrations(mg *Migrator) {
mg.AddMigration("alter table query_history alter column created_by type to bigint", NewRawSQLMigration("").
Mysql("ALTER TABLE query_history MODIFY created_by BIGINT;").
Postgres("ALTER TABLE query_history ALTER COLUMN created_by TYPE BIGINT;"))
queryHistoryDetailsV1 := Table{
Name: "query_history_details",
Columns: []*Column{
{Name: "id", Type: DB_BigInt, Nullable: false, IsPrimaryKey: true, IsAutoIncrement: true},
{Name: "query_history_item_uid", Type: DB_NVarchar, Length: 40, Nullable: false},
{Name: "datasource_uid", Type: DB_NVarchar, Length: 40, Nullable: false},
},
}
mg.AddMigration("create query_history_details table v1", NewAddTableMigration(queryHistoryDetailsV1))
}