Skip to content

Commit c2d3691

Browse files
author
Philippe Lafoucrière
committed
Add Execute func to driver
1 parent 004ff13 commit c2d3691

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

mysql.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ type Driver struct {
2525
db *sql.DB
2626
}
2727

28+
// make sure our driver still implements the driver.Driver interface
29+
var _ driver.Driver = (*Driver)(nil)
30+
2831
const tableName = "schema_migrations"
2932

3033
func (driver *Driver) Initialize(url string) error {
@@ -242,6 +245,12 @@ func (driver *Driver) Versions() (file.Versions, error) {
242245
return versions, err
243246
}
244247

248+
// Execute a SQL statement
249+
func (driver *Driver) Execute(statement string) error {
250+
_, err := driver.db.Exec(statement)
251+
return err
252+
}
253+
245254
func init() {
246255
driver.RegisterDriver("mysql", &Driver{})
247256
}

0 commit comments

Comments
 (0)