2017-03-30 06:46:46 -05:00
|
|
|
package migrations
|
|
|
|
|
|
|
|
import . "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
|
|
|
|
2018-04-24 11:52:57 -05:00
|
|
|
// commented out because of the deadcode CI check
|
2020-09-22 09:22:19 -05:00
|
|
|
// func addStatsMigrations(mg *Migrator) {
|
2018-04-24 11:52:57 -05:00
|
|
|
// statTable := Table{
|
|
|
|
// Name: "stat",
|
|
|
|
// Columns: []*Column{
|
|
|
|
// {Name: "id", Type: DB_Int, IsPrimaryKey: true, IsAutoIncrement: true},
|
|
|
|
// {Name: "metric", Type: DB_Varchar, Length: 20, Nullable: false},
|
|
|
|
// {Name: "type", Type: DB_Int, Nullable: false},
|
|
|
|
// },
|
|
|
|
// Indices: []*Index{
|
|
|
|
// {Cols: []string{"metric"}, Type: UniqueIndex},
|
|
|
|
// },
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// // create table
|
|
|
|
// mg.AddMigration("create stat table", NewAddTableMigration(statTable))
|
|
|
|
//
|
|
|
|
// // create indices
|
|
|
|
// mg.AddMigration("add index stat.metric", NewAddIndexMigration(statTable, statTable.Indices[0]))
|
|
|
|
//
|
|
|
|
// statValue := Table{
|
|
|
|
// Name: "stat_value",
|
|
|
|
// Columns: []*Column{
|
|
|
|
// {Name: "id", Type: DB_Int, IsPrimaryKey: true, IsAutoIncrement: true},
|
|
|
|
// {Name: "value", Type: DB_Double, Nullable: false},
|
|
|
|
// {Name: "time", Type: DB_DateTime, Nullable: false},
|
|
|
|
// },
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// // create table
|
|
|
|
// mg.AddMigration("create stat_value table", NewAddTableMigration(statValue))
|
2020-09-22 09:22:19 -05:00
|
|
|
// }
|
2017-03-30 11:03:50 -05:00
|
|
|
|
|
|
|
func addTestDataMigrations(mg *Migrator) {
|
|
|
|
testData := Table{
|
|
|
|
Name: "test_data",
|
|
|
|
Columns: []*Column{
|
|
|
|
{Name: "id", Type: DB_Int, IsPrimaryKey: true, IsAutoIncrement: true},
|
|
|
|
{Name: "metric1", Type: DB_Varchar, Length: 20, Nullable: true},
|
|
|
|
{Name: "metric2", Type: DB_NVarchar, Length: 150, Nullable: true},
|
2017-03-30 13:23:40 -05:00
|
|
|
{Name: "value_big_int", Type: DB_BigInt, Nullable: true},
|
2017-03-30 11:03:50 -05:00
|
|
|
{Name: "value_double", Type: DB_Double, Nullable: true},
|
|
|
|
{Name: "value_float", Type: DB_Float, Nullable: true},
|
|
|
|
{Name: "value_int", Type: DB_Int, Nullable: true},
|
|
|
|
{Name: "time_epoch", Type: DB_BigInt, Nullable: false},
|
2017-03-31 04:45:25 -05:00
|
|
|
{Name: "time_date_time", Type: DB_DateTime, Nullable: false},
|
|
|
|
{Name: "time_time_stamp", Type: DB_TimeStamp, Nullable: false},
|
2017-03-30 11:03:50 -05:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
// create table
|
|
|
|
mg.AddMigration("create test_data table", NewAddTableMigration(testData))
|
|
|
|
}
|