Skip to content

Commit

Permalink
pass context to db
Browse files Browse the repository at this point in the history
  • Loading branch information
cenkalti committed Oct 2, 2020
1 parent 0f51ffa commit 9cdef80
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/table/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ func (t *Table) Create(ctx context.Context) error {

func (t *Table) Drop(ctx context.Context) error {
dropSQL := "DROP TABLE " + t.name
_, err := t.db.Exec(dropSQL)
_, err := t.db.ExecContext(ctx, dropSQL)
if err != nil {
if myErr, ok := err.(*mysql.MySQLError); !ok || myErr.Number != 1051 { // Unknown table
return err
}
}
dropSQL = "DROP TABLE " + t.name + "_instances"
_, err = t.db.Exec(dropSQL)
_, err = t.db.ExecContext(ctx, dropSQL)
if err != nil {
if myErr, ok := err.(*mysql.MySQLError); !ok || myErr.Number != 1051 { // Unknown table
return err
Expand Down

0 comments on commit 9cdef80

Please sign in to comment.