Skip to content

Commit

Permalink
fix postgres syntax error during migration
Browse files Browse the repository at this point in the history
  • Loading branch information
chaahk committed Nov 18, 2015
1 parent 821b2f8 commit 29ac961
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions migration/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,15 @@ func (m *Migration) addOrUpdateRecord(name, status string) error {
o := orm.NewOrm()
if status == "down" {
status = "rollback"
p, err := o.Raw("update migrations set `status` = ?, `rollback_statements` = ?, `created_at` = ? where name = ?").Prepare()
p, err := o.Raw("update migrations set status = ?, rollback_statements = ?, created_at = ? where name = ?").Prepare()
if err != nil {
return nil
}
_, err = p.Exec(status, strings.Join(m.sqls, "; "), time.Now().Format(DBDateFormat), name)
return err
}
status = "update"
p, err := o.Raw("insert into migrations(`name`, `created_at`, `statements`, `status`) values(?,?,?,?)").Prepare()
p, err := o.Raw("insert into migrations(name, created_at, statements, status) values(?,?,?,?)").Prepare()
if err != nil {
return err
}
Expand Down

0 comments on commit 29ac961

Please sign in to comment.