Extract search users functions into a service (#39002)

* Extract search users to a new service

* Fix wire provider

* Fix common_test and remove RouteRegister

* Remove old endpoints

* Fix test

* Add indexes to dashboards and orgs tables

* Fix lint
This commit is contained in:
Selene
2021-09-29 12:51:49 +02:00
committed by GitHub
parent 0ecf13e5a3
commit 02702eb82d
12 changed files with 148 additions and 74 deletions
@@ -20,6 +20,10 @@ func addDashboardAclMigrations(mg *Migrator) {
{Cols: []string{"dashboard_id"}},
{Cols: []string{"dashboard_id", "user_id"}, Type: UniqueIndex},
{Cols: []string{"dashboard_id", "team_id"}, Type: UniqueIndex},
{Cols: []string{"user_id"}},
{Cols: []string{"team_id"}},
{Cols: []string{"org_id", "role"}},
{Cols: []string{"permission"}},
},
}
@@ -29,6 +33,10 @@ func addDashboardAclMigrations(mg *Migrator) {
mg.AddMigration("add index dashboard_acl_dashboard_id", NewAddIndexMigration(dashboardAclV1, dashboardAclV1.Indices[0]))
mg.AddMigration("add unique index dashboard_acl_dashboard_id_user_id", NewAddIndexMigration(dashboardAclV1, dashboardAclV1.Indices[1]))
mg.AddMigration("add unique index dashboard_acl_dashboard_id_team_id", NewAddIndexMigration(dashboardAclV1, dashboardAclV1.Indices[2]))
mg.AddMigration("add index dashboard_acl_user_id", NewAddIndexMigration(dashboardAclV1, dashboardAclV1.Indices[3]))
mg.AddMigration("add index dashboard_acl_team_id", NewAddIndexMigration(dashboardAclV1, dashboardAclV1.Indices[4]))
mg.AddMigration("add index dashboard_acl_org_id_role", NewAddIndexMigration(dashboardAclV1, dashboardAclV1.Indices[5]))
mg.AddMigration("add index dashboard_permission", NewAddIndexMigration(dashboardAclV1, dashboardAclV1.Indices[6]))
const rawSQL = `
INSERT INTO dashboard_acl
@@ -225,4 +225,9 @@ func addDashboardMigration(mg *Migrator) {
mg.AddMigration("delete stars for deleted dashboards", NewRawSQLMigration(
"DELETE FROM star WHERE dashboard_id NOT IN (SELECT id FROM dashboard)"))
mg.AddMigration("Add index for dashboard_is_folder", NewAddIndexMigration(dashboardV2, &Index{
Cols: []string{"is_folder"},
Type: IndexType,
}))
}
@@ -41,6 +41,7 @@ func addOrgMigrations(mg *Migrator) {
Indices: []*Index{
{Cols: []string{"org_id"}},
{Cols: []string{"org_id", "user_id"}, Type: UniqueIndex},
{Cols: []string{"user_id"}},
},
}