mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
mysql: minor update
This commit is contained in:
@@ -41,7 +41,7 @@ func addTestDataMigrations(mg *Migrator) {
|
||||
{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_ing", Type: DB_BigInt, 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},
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package sqlstore
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/grafana/grafana/pkg/bus"
|
||||
m "github.com/grafana/grafana/pkg/models"
|
||||
)
|
||||
@@ -12,10 +14,17 @@ func init() {
|
||||
func InsertSqlTestData(cmd *m.InsertSqlTestDataCommand) error {
|
||||
return inTransaction2(func(sess *session) error {
|
||||
|
||||
// create user
|
||||
user := &m.SqlTestData{}
|
||||
row := &m.SqlTestData{
|
||||
Metric1: "server1",
|
||||
Metric2: "frontend",
|
||||
ValueBigInt: 123123,
|
||||
ValueDouble: 3.14159265359,
|
||||
ValueFloat: 3.14159265359,
|
||||
TimeEpoch: time.Now().Unix(),
|
||||
TimeDateTime: time.Now(),
|
||||
}
|
||||
|
||||
if _, err := sess.Insert(user); err != nil {
|
||||
if _, err := sess.Table("test_data").Insert(row); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user