Skip to content

Commit

Permalink
First half of a fix for gobuffalo/pop#148
Browse files Browse the repository at this point in the history
  • Loading branch information
markbates committed Jun 27, 2018
1 parent 3927b3b commit 54d48e0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,9 @@ drop_foreign_key("table_name", "fk_name", {"if_exists": true})
## Raw SQL

``` javascript
raw("select * from users;")
sql("select * from users;")
```

*All calls to `raw` must end with a `;`!*

## Execute an External Command

Sometimes during a migration you need to shell out to an external command.
Expand Down
1 change: 1 addition & 0 deletions bubbler.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func (b *Bubbler) Bubble(s string) (string, error) {
"drop_column": f.DropColumn,
"rename_column": f.RenameColumn,
"raw": f.RawSql,
"sql": f.RawSql,
"add_index": f.AddIndex,
"drop_index": f.DropIndex,
"rename_index": f.RenameIndex,
Expand Down
5 changes: 2 additions & 3 deletions fizz.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package fizz
import (
"io"
"io/ioutil"
"log"
"os"
"os/exec"
"strings"
Expand All @@ -19,7 +18,7 @@ type fizzer struct {

func (f fizzer) add(s string, err error) error {
if err != nil {
panic(err.Error())
return errors.WithStack(err)
}
f.Bubbler.data = append(f.Bubbler.data, s)
return nil
Expand All @@ -43,7 +42,7 @@ func (f fizzer) Exec(out io.Writer) func(string) error {
func AFile(f *os.File, t Translator) (string, error) {
b, err := ioutil.ReadAll(f)
if err != nil {
log.Fatal(err)
return "", errors.WithStack(err)
}
return AString(string(b), t)
}
Expand Down
4 changes: 3 additions & 1 deletion raw_sql.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package fizz

import "strings"
import (
"strings"
)

func (f fizzer) RawSql(sql string) {
if !strings.HasSuffix(sql, ";") {
Expand Down

0 comments on commit 54d48e0

Please sign in to comment.