Teams: Add index for permission check (#25736)

* Teams: Add indices for permission check

* Teams: Remove user_id index
This commit is contained in:
Emil Tullstedt 2020-06-26 15:13:53 +02:00 committed by GitHub
parent 504b786141
commit 5d7cd2e9fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,6 +37,7 @@ func addTeamMigrations(mg *Migrator) {
Indices: []*Index{ Indices: []*Index{
{Cols: []string{"org_id"}}, {Cols: []string{"org_id"}},
{Cols: []string{"org_id", "team_id", "user_id"}, Type: UniqueIndex}, {Cols: []string{"org_id", "team_id", "user_id"}, Type: UniqueIndex},
{Cols: []string{"team_id"}},
}, },
} }
@ -45,6 +46,7 @@ func addTeamMigrations(mg *Migrator) {
//------- indexes ------------------ //------- indexes ------------------
mg.AddMigration("add index team_member.org_id", NewAddIndexMigration(teamMemberV1, teamMemberV1.Indices[0])) mg.AddMigration("add index team_member.org_id", NewAddIndexMigration(teamMemberV1, teamMemberV1.Indices[0]))
mg.AddMigration("add unique index team_member_org_id_team_id_user_id", NewAddIndexMigration(teamMemberV1, teamMemberV1.Indices[1])) mg.AddMigration("add unique index team_member_org_id_team_id_user_id", NewAddIndexMigration(teamMemberV1, teamMemberV1.Indices[1]))
mg.AddMigration("add index team_member.team_id", NewAddIndexMigration(teamMemberV1, teamMemberV1.Indices[2]))
// add column email // add column email
mg.AddMigration("Add column email to team table", NewAddColumnMigration(teamV1, &Column{ mg.AddMigration("Add column email to team table", NewAddColumnMigration(teamV1, &Column{