mirror of
https://github.com/grafana/grafana.git
synced 2025-01-18 12:33:37 -06:00
APIKeys: add API key migration to ensure fk is null (#46285)
This commit is contained in:
parent
0debf33c76
commit
c6cae8411a
@ -182,7 +182,7 @@ func (hs *HTTPServer) declareFixedRoles() error {
|
||||
},
|
||||
},
|
||||
},
|
||||
Grants: []string{"Admin"},
|
||||
Grants: []string{string(models.ROLE_ADMIN)},
|
||||
}
|
||||
|
||||
orgReaderRole := ac.RoleRegistration{
|
||||
|
@ -1,6 +1,8 @@
|
||||
package migrations
|
||||
|
||||
import . "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
||||
import (
|
||||
. "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
||||
)
|
||||
|
||||
func addApiKeyMigrations(mg *Migrator) {
|
||||
apiKeyV1 := Table{
|
||||
@ -86,4 +88,7 @@ func addApiKeyMigrations(mg *Migrator) {
|
||||
mg.AddMigration("Add service account foreign key", NewAddColumnMigration(apiKeyV2, &Column{
|
||||
Name: "service_account_id", Type: DB_BigInt, Nullable: true,
|
||||
}))
|
||||
|
||||
mg.AddMigration("set service account foreign key to nil if 0", NewRawSQLMigration(
|
||||
"UPDATE api_key SET service_account_id = NULL WHERE service_account_id = 0;"))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user