diff --git a/sqlmigr/executor.go b/sqlmigr/executor.go index 5976a65..8c716cd 100644 --- a/sqlmigr/executor.go +++ b/sqlmigr/executor.go @@ -31,9 +31,9 @@ func (m *Executor) Setup() error { up := &bytes.Buffer{} fmt.Fprintln(up, "CREATE TABLE IF NOT EXISTS migrations (") - fmt.Fprintln(up, " id CHAR(14) NOT NULL PRIMARY KEY,") - fmt.Fprintln(up, " description TEXT NOT NULL,") - fmt.Fprintln(up, " created_at TIMESTAMP NOT NULL") + fmt.Fprintln(up, " id VARCHAR(14) NOT NULL PRIMARY KEY,") + fmt.Fprintln(up, " description TEXT NOT NULL,") + fmt.Fprintln(up, " created_at TIMESTAMP NOT NULL") fmt.Fprintln(up, ");") fmt.Fprintln(up) diff --git a/sqlmigr/executor_test.go b/sqlmigr/executor_test.go index 9cd682e..6099879 100644 --- a/sqlmigr/executor_test.go +++ b/sqlmigr/executor_test.go @@ -54,9 +54,9 @@ var _ = Describe("Executor", func() { up := &bytes.Buffer{} fmt.Fprintln(up, "CREATE TABLE IF NOT EXISTS migrations (") - fmt.Fprintln(up, " id CHAR(14) NOT NULL PRIMARY KEY,") - fmt.Fprintln(up, " description TEXT NOT NULL,") - fmt.Fprintln(up, " created_at TIMESTAMP NOT NULL") + fmt.Fprintln(up, " id VARCHAR(14) NOT NULL PRIMARY KEY,") + fmt.Fprintln(up, " description TEXT NOT NULL,") + fmt.Fprintln(up, " created_at TIMESTAMP NOT NULL") fmt.Fprintln(up, ");") fmt.Fprintln(up) Expect(string(data)).To(Equal(up.String())) diff --git a/sqlmigr/generator.go b/sqlmigr/generator.go index 105b10e..7eb7dce 100644 --- a/sqlmigr/generator.go +++ b/sqlmigr/generator.go @@ -64,8 +64,9 @@ func (g *Generator) write(filename string, data []byte, perm os.FileMode) error } if writer, ok := f.(io.Writer); ok { - n, err := writer.Write(data) - if err == nil && n < len(data) { + var n int + + if n, err = writer.Write(data); err == nil && n < len(data) { err = io.ErrShortWrite } }