Skip to content

Commit

Permalink
Remove legacy Anko format fixer (#366)
Browse files Browse the repository at this point in the history
It can still be called using soda fix command.
  • Loading branch information
stanislas-m authored Mar 18, 2019
1 parent 669c04a commit 781acef
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions file_migrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ import (
"io/ioutil"
"os"
"path/filepath"
"strings"
"text/template"

"github.com/gobuffalo/fizz"
"github.com/gobuffalo/pop/fix"
"github.com/gobuffalo/pop/logging"
"github.com/pkg/errors"
)

Expand Down Expand Up @@ -102,27 +99,13 @@ func migrationContent(mf Migration, c *Connection, r io.Reader) (string, error)
return "", nil
}

content := string(b)

if mf.Type == "fizz" {
// test for && fix anko migrations
fixed, err := fix.Anko(content)
if err != nil {
return "", errors.Wrapf(err, "could not fizz the migration %s", mf.Path)
}
if strings.TrimSpace(fixed) != strings.TrimSpace(content) {
log(logging.Warn, "%s uses an old fizz syntax. please use\n%s", mf.Path, fixed)
}
content = fixed
}

t := template.Must(template.New("sql").Parse(content))
t := template.Must(template.New("sql").Parse(string(b)))
var bb bytes.Buffer
err = t.Execute(&bb, c.Dialect.Details())
if err != nil {
return "", errors.Wrapf(err, "could not execute migration template %s", mf.Path)
}
content = bb.String()
content := bb.String()

if mf.Type == "fizz" {
content, err = fizz.AString(content, c.Dialect.FizzTranslator())
Expand Down

0 comments on commit 781acef

Please sign in to comment.