Commits

Joshua Foster committed 5fc48cb

migrate to use mysql instead of mymysql

Comments (0)

Files changed (11)

 
 You can manage your database's evolution by creating incremental SQL or Go scripts.
 
-[![Build Status](https://drone.io/bitbucket.org/liamstask/goose/status.png)](https://drone.io/bitbucket.org/liamstask/goose/latest)
+[![Build Status](https://drone.io/bitbucket.org/jhawk28/goose/status.png)](https://drone.io/bitbucket.org/jhawk28/goose/latest)
 
 # Install
 
-    $ go get bitbucket.org/liamstask/goose/cmd/goose
+    $ go get bitbucket.org/jhawk28/goose/cmd/goose
 
 This will install the `goose` binary to your `$GOPATH/bin` directory.
 
-You can also build goose into your own applications by importing `bitbucket.org/liamstask/goose/lib/goose`. Documentation is available at [godoc.org](http://godoc.org/bitbucket.org/liamstask/goose/lib/goose).
+You can also build goose into your own applications by importing `bitbucket.org/jhawk28/goose/lib/goose`. Documentation is available at [godoc.org](http://godoc.org/bitbucket.org/jhawk28/goose/lib/goose).
 
 NOTE: the API is still new, and may undergo some changes.
 
     // note: need at least one blank line after build constraint
     package main
 
-    import _ "bitbucket.org/liamstask/goose/cmd/goose"
+    import _ "bitbucket.org/jhawk28/goose/cmd/goose"
 
 [Set up your Heroku database(s) as usual.](https://devcenter.heroku.com/articles/heroku-postgresql)
 

cmd/goose/cmd_create.go

 package main
 
 import (
-	"bitbucket.org/liamstask/goose/lib/goose"
+	"bitbucket.org/jhawk28/goose/lib/goose"
 	"fmt"
 	"log"
 	"os"

cmd/goose/cmd_down.go

 package main
 
 import (
-	"bitbucket.org/liamstask/goose/lib/goose"
+	"bitbucket.org/jhawk28/goose/lib/goose"
 	"log"
 )
 

cmd/goose/cmd_redo.go

 package main
 
 import (
-	"bitbucket.org/liamstask/goose/lib/goose"
+	"bitbucket.org/jhawk28/goose/lib/goose"
 	"log"
 )
 

cmd/goose/cmd_status.go

 package main
 
 import (
-	"bitbucket.org/liamstask/goose/lib/goose"
+	"bitbucket.org/jhawk28/goose/lib/goose"
 	"database/sql"
 	"fmt"
 	"log"
 	"path/filepath"
-	"time"
 )
 
 var statusCmd = &Command{
 	var row goose.MigrationRecord
 	q := fmt.Sprintf("SELECT tstamp, is_applied FROM goose_db_version WHERE version_id=%d ORDER BY tstamp DESC LIMIT 1", version)
 	e := db.QueryRow(q).Scan(&row.TStamp, &row.IsApplied)
-
 	if e != nil && e != sql.ErrNoRows {
 		log.Fatal(e)
 	}
 	var appliedAt string
 
 	if row.IsApplied {
-		appliedAt = row.TStamp.Format(time.ANSIC)
+		appliedAt = row.TStamp
 	} else {
 		appliedAt = "Pending"
 	}
 package main
 
 import (
-	"bitbucket.org/liamstask/goose/lib/goose"
+	"bitbucket.org/jhawk28/goose/lib/goose"
 	"log"
 )
 
 package main
 
 import (
-	"bitbucket.org/liamstask/goose/lib/goose"
+	"bitbucket.org/jhawk28/goose/lib/goose"
 	"flag"
 	"fmt"
 	"os"
     open: user=liam dbname=tester sslmode=disable
 
 development:
-    driver: postgres
-    open: user=liam dbname=tester sslmode=disable
+    driver: mysql
+    open: root:@/dbname
     
 production:
     driver: postgres
 		d.Import = "github.com/lib/pq"
 		d.Dialect = &PostgresDialect{}
 
-	case "mymysql":
-		d.Import = "github.com/ziutek/mymysql/godrv"
+	case "mysql":
+		d.Import = "github.com/go-sql-driver/mysql"
 		d.Dialect = &MySqlDialect{}
 
 	case "sqlite3":
 	"database/sql"
 	"errors"
 	"fmt"
+	_ "github.com/go-sql-driver/mysql"
 	_ "github.com/lib/pq"
-	_ "github.com/ziutek/mymysql/godrv"
 	_ "github.com/mattn/go-sqlite3"
 	"log"
 	"os"
 
 type MigrationRecord struct {
 	VersionId int64
-	TStamp    time.Time
+	TStamp    string
 	IsApplied bool // was this a result of up() or down()
 }
 

lib/goose/migration_sql.go

 
 	if upSections == 0 && downSections == 0 {
 		log.Fatalf(`ERROR: no Up/Down annotations found, so no statements were executed.
-			See https://bitbucket.org/liamstask/goose/overview for details.`)
+			See https://bitbucket.org/jhawk28/goose/overview for details.`)
 	}
 
 	return