Skip to content

Commit

Permalink
Add Execute func to driver
Browse files Browse the repository at this point in the history
  • Loading branch information
Philippe Lafoucrière committed Apr 6, 2017
1 parent 004ff13 commit c2d3691
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ type Driver struct {
db *sql.DB
}

// make sure our driver still implements the driver.Driver interface
var _ driver.Driver = (*Driver)(nil)

const tableName = "schema_migrations"

func (driver *Driver) Initialize(url string) error {
Expand Down Expand Up @@ -242,6 +245,12 @@ func (driver *Driver) Versions() (file.Versions, error) {
return versions, err
}

// Execute a SQL statement
func (driver *Driver) Execute(statement string) error {
_, err := driver.db.Exec(statement)
return err
}

func init() {
driver.RegisterDriver("mysql", &Driver{})
}

0 comments on commit c2d3691

Please sign in to comment.