Add a warning on non-empty buffer.

pull/2/head
Vinicius Baggio Fuentes 2014-11-29 22:10:55 -05:00
parent a72c5a598e
commit 3952118555
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.`)