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:
Arve Knudsen
2020-11-11 06:21:08 +01:00
committed by GitHub
parent 7abf0506b1
commit b5379c5335
68 changed files with 377 additions and 376 deletions

View File

@ -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)
}