Merged in vinibaggio/goose/vinibaggio-raise-error-on-incomplete-buffer (pull request #45)

Add a warning on non-empty buffer.
pull/2/head
Parker Moore 2015-01-14 22:27:00 -08:00
commit 9d1a22dde8
1 changed files with 4 additions and 0 deletions

View File

@ -115,6 +115,10 @@ func splitSQLStatements(r io.Reader, direction bool) (stmts []string) {
log.Println("WARNING: saw '-- +goose StatementBegin' with no matching '-- +goose StatementEnd'")
}
if bufferRemaining := strings.TrimSpace(buf.String()); len(bufferRemaining) > 0 {
log.Printf("WARNING: Unexpected unfinished SQL query: %s. Missing a semicolon?\n", bufferRemaining)
}
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.`)