~egtann/migrate

e5cd7ca5dd9f9bd3e57414765ec3f69419d0683e — Evan Tann 1 year, 2 months ago 09e2d6a
fix mysql 5.7 bug
1 files changed, 9 insertions(+), 4 deletions(-)

M mysql/mysql.go
M mysql/mysql.go => mysql/mysql.go +9 -4
@@ 6,6 6,7 @@ import (
	"database/sql"
	"fmt"
	"io/ioutil"
	"strings"

	"github.com/egtann/migrate"
	"github.com/go-sql-driver/mysql"


@@ 185,10 186,14 @@ func (db *DB) UpgradeToV1(migrations []migrate.Migration) (err error) {
	// Add the content column to metacheckpoints
	q = `
	ALTER TABLE metacheckpoints
	ADD COLUMN IF NOT EXISTS content TEXT NOT NULL`
	if _, err = tx.Exec(q); err != nil {
		err = errors.Wrap(err, "add metacheckpoints content")
		return
	ADD COLUMN content TEXT NOT NULL`
	_, err = tx.Exec(q)
	if err != nil {
		// Ignore duplicate column errors
		if !strings.Contains(err.Error(), "Duplicate column name") {
			err = errors.Wrap(err, "add metacheckpoints content")
			return
		}
	}

	q = `