mirror of
https://github.com/grafana/grafana.git
synced 2025-08-03 05:08:36 +08:00
Chore: Fix SQL related Go variable naming (#28887)
* Chore: Fix variable naming Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
@ -20,8 +20,8 @@ type Migrator struct {
|
||||
|
||||
type MigrationLog struct {
|
||||
Id int64
|
||||
MigrationId string
|
||||
Sql string
|
||||
MigrationID string `xorm:"migration_id"`
|
||||
SQL string `xorm:"sql"`
|
||||
Success bool
|
||||
Error string
|
||||
Timestamp time.Time
|
||||
@ -65,7 +65,7 @@ func (mg *Migrator) GetMigrationLog() (map[string]MigrationLog, error) {
|
||||
if !logItem.Success {
|
||||
continue
|
||||
}
|
||||
logMap[logItem.MigrationId] = logItem
|
||||
logMap[logItem.MigrationID] = logItem
|
||||
}
|
||||
|
||||
return logMap, nil
|
||||
@ -87,11 +87,11 @@ func (mg *Migrator) Start() error {
|
||||
continue
|
||||
}
|
||||
|
||||
sql := m.Sql(mg.Dialect)
|
||||
sql := m.SQL(mg.Dialect)
|
||||
|
||||
record := MigrationLog{
|
||||
MigrationId: m.Id(),
|
||||
Sql: sql,
|
||||
MigrationID: m.Id(),
|
||||
SQL: sql,
|
||||
Timestamp: time.Now(),
|
||||
}
|
||||
|
||||
@ -122,7 +122,7 @@ func (mg *Migrator) exec(m Migration, sess *xorm.Session) error {
|
||||
|
||||
condition := m.GetCondition()
|
||||
if condition != nil {
|
||||
sql, args := condition.Sql(mg.Dialect)
|
||||
sql, args := condition.SQL(mg.Dialect)
|
||||
|
||||
if sql != "" {
|
||||
mg.Logger.Debug("Executing migration condition sql", "id", m.Id(), "sql", sql, "args", args)
|
||||
@ -144,7 +144,7 @@ func (mg *Migrator) exec(m Migration, sess *xorm.Session) error {
|
||||
mg.Logger.Debug("Executing code migration", "id", m.Id())
|
||||
err = codeMigration.Exec(sess, mg)
|
||||
} else {
|
||||
sql := m.Sql(mg.Dialect)
|
||||
sql := m.SQL(mg.Dialect)
|
||||
mg.Logger.Debug("Executing sql migration", "id", m.Id(), "sql", sql)
|
||||
_, err = sess.Exec(sql)
|
||||
}
|
||||
|
Reference in New Issue
Block a user