mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
add garbage collector for database cache
This commit is contained in:
@@ -1,17 +1,22 @@
|
||||
package migrations
|
||||
|
||||
import . "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
||||
import "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
||||
|
||||
func addCacheMigration(mg *Migrator) {
|
||||
var cacheDataV1 = Table{
|
||||
func addCacheMigration(mg *migrator.Migrator) {
|
||||
var cacheDataV1 = migrator.Table{
|
||||
Name: "cache_data",
|
||||
Columns: []*Column{
|
||||
{Name: "key", Type: DB_Char, IsPrimaryKey: true, Length: 16},
|
||||
{Name: "data", Type: DB_Blob},
|
||||
{Name: "expires", Type: DB_Integer, Length: 255, Nullable: false},
|
||||
{Name: "created_at", Type: DB_Integer, Length: 255, Nullable: false},
|
||||
Columns: []*migrator.Column{
|
||||
{Name: "key", Type: migrator.DB_NVarchar, IsPrimaryKey: true, Length: 168},
|
||||
{Name: "data", Type: migrator.DB_Blob},
|
||||
{Name: "expires", Type: migrator.DB_Integer, Length: 255, Nullable: false},
|
||||
{Name: "created_at", Type: migrator.DB_Integer, Length: 255, Nullable: false},
|
||||
},
|
||||
Indices: []*migrator.Index{
|
||||
{Cols: []string{"key"}, Type: migrator.UniqueIndex},
|
||||
},
|
||||
}
|
||||
|
||||
mg.AddMigration("create cache_data table", NewAddTableMigration(cacheDataV1))
|
||||
mg.AddMigration("create cache_data table", migrator.NewAddTableMigration(cacheDataV1))
|
||||
|
||||
mg.AddMigration("add unique index cache_data.key", migrator.NewAddIndexMigration(cacheDataV1, cacheDataV1.Indices[0]))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user