2019-02-14 16:13:46 -06:00
|
|
|
package migrations
|
|
|
|
|
2019-02-15 07:31:52 -06:00
|
|
|
import "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
2019-02-14 16:13:46 -06:00
|
|
|
|
2019-02-15 07:31:52 -06:00
|
|
|
func addCacheMigration(mg *migrator.Migrator) {
|
|
|
|
var cacheDataV1 = migrator.Table{
|
2019-02-14 16:13:46 -06:00
|
|
|
Name: "cache_data",
|
2019-02-15 07:31:52 -06:00
|
|
|
Columns: []*migrator.Column{
|
2019-03-07 12:07:11 -06:00
|
|
|
{Name: "cache_key", Type: migrator.DB_NVarchar, IsPrimaryKey: true, Length: 168},
|
2019-02-15 07:31:52 -06:00
|
|
|
{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{
|
2019-03-07 12:07:11 -06:00
|
|
|
{Cols: []string{"cache_key"}, Type: migrator.UniqueIndex},
|
2019-02-14 16:13:46 -06:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2019-02-15 07:31:52 -06:00
|
|
|
mg.AddMigration("create cache_data table", migrator.NewAddTableMigration(cacheDataV1))
|
|
|
|
|
2019-03-07 12:07:11 -06:00
|
|
|
mg.AddMigration("add unique index cache_data.cache_key", migrator.NewAddIndexMigration(cacheDataV1, cacheDataV1.Indices[0]))
|
2019-02-14 16:13:46 -06:00
|
|
|
}
|