mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Anon: Scaffold anon service (#74744)
* remove API tagging method and authed tagging * add anonstore move debug to after cache change test order fix issue where mysql trims to second * add old device cleanup lint utc-ize everything trim whitespace * remove dangling setting * Add delete devices * Move anonymous authnclient to anonimpl * Add simple post login hook * move registration of Background Service cleanup * add updated_at index * do not untag device if login err * add delete device integration test
This commit is contained in:
25
pkg/services/sqlstore/migrations/anonservice/migrations.go
Normal file
25
pkg/services/sqlstore/migrations/anonservice/migrations.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package anonservice
|
||||
|
||||
import "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
||||
|
||||
func AddMigration(mg *migrator.Migrator) {
|
||||
var anonV1 = migrator.Table{
|
||||
Name: "anon_device",
|
||||
Columns: []*migrator.Column{
|
||||
{Name: "id", Type: migrator.DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
|
||||
{Name: "client_ip", Type: migrator.DB_NVarchar, Length: 255, Nullable: false},
|
||||
{Name: "created_at", Type: migrator.DB_DateTime, Nullable: false},
|
||||
{Name: "device_id", Type: migrator.DB_NVarchar, Length: 127, Nullable: false},
|
||||
{Name: "updated_at", Type: migrator.DB_DateTime, Nullable: false},
|
||||
{Name: "user_agent", Type: migrator.DB_NVarchar, Length: 255, Nullable: false},
|
||||
},
|
||||
Indices: []*migrator.Index{
|
||||
{Cols: []string{"device_id"}, Type: migrator.UniqueIndex},
|
||||
{Cols: []string{"updated_at"}, Type: migrator.IndexType},
|
||||
},
|
||||
}
|
||||
|
||||
mg.AddMigration("create anon_device table", migrator.NewAddTableMigration(anonV1))
|
||||
mg.AddMigration("add unique index anon_device.device_id", migrator.NewAddIndexMigration(anonV1, anonV1.Indices[0]))
|
||||
mg.AddMigration("add index anon_device.updated_at", migrator.NewAddIndexMigration(anonV1, anonV1.Indices[1]))
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package migrations
|
||||
import (
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore/migrations/accesscontrol"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore/migrations/anonservice"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore/migrations/oauthserver"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore/migrations/ualert"
|
||||
. "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
||||
@@ -96,6 +97,8 @@ func (*OSSMigrations) AddMigration(mg *Migrator) {
|
||||
oauthserver.AddMigration(mg)
|
||||
}
|
||||
}
|
||||
|
||||
anonservice.AddMigration(mg)
|
||||
}
|
||||
|
||||
func addStarMigrations(mg *Migrator) {
|
||||
|
||||
Reference in New Issue
Block a user