代码拉取完成,页面将自动刷新
package migrations
import . "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
// commented out because of the deadcode CI check
//func addStatsMigrations(mg *Migrator) {
// 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))
//}
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},
{Name: "value_big_int", Type: DB_BigInt, Nullable: true},
{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},
{Name: "time_date_time", Type: DB_DateTime, Nullable: false},
{Name: "time_time_stamp", Type: DB_TimeStamp, Nullable: false},
},
}
// create table
mg.AddMigration("create test_data table", NewAddTableMigration(testData))
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。