Alerting: fix postgres migration on conflict (#35556) (#35653)

(cherry picked from commit 423474325a)

Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com>
This commit is contained in:
Grot (@grafanabot)
2021-06-14 18:09:27 +03:00
committed by GitHub
co-authored by Sofia Papagiannaki
parent 8ac34f9c76
commit 732f794e16
2 changed files with 11 additions and 3 deletions
+2 -2
View File
@@ -103,7 +103,7 @@ func (mg *Migrator) Start() error {
Timestamp: time.Now(),
}
err := mg.inTransaction(func(sess *xorm.Session) error {
err := mg.InTransaction(func(sess *xorm.Session) error {
err := mg.exec(m, sess)
if err != nil {
mg.Logger.Error("Exec failed", "error", err, "sql", sql)
@@ -183,7 +183,7 @@ func (mg *Migrator) ClearMigrationEntry(id string) error {
type dbTransactionFunc func(sess *xorm.Session) error
func (mg *Migrator) inTransaction(callback dbTransactionFunc) error {
func (mg *Migrator) InTransaction(callback dbTransactionFunc) error {
sess := mg.x.NewSession()
defer sess.Close()