File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change 55 "fmt"
66 "os"
77 "path/filepath"
8- "strings"
98 "time"
109
1110 "ariga.io/atlas/sql/migrate"
@@ -170,6 +169,14 @@ func createFile(f string, content string) error {
170169 return nil
171170}
172171
172+ func createSQL (stats []string ) string {
173+ var sql string
174+ for _ , stat := range stats {
175+ sql += stat + ";\n " // TODO: support windows line break
176+ }
177+ return sql
178+ }
179+
173180func dbMigrateGenerate () error {
174181 sch , err := newSchema ()
175182 if err != nil {
@@ -201,7 +208,7 @@ func dbMigrateGenerate() error {
201208 downs := []string {}
202209 for _ , change := range changes {
203210 if change .Cmd != "" {
204- ups = append (ups , change .Cmd + ";" )
211+ ups = append (ups , change .Cmd )
205212 }
206213
207214 stmts , err := change .ReverseStmts ()
@@ -210,9 +217,8 @@ func dbMigrateGenerate() error {
210217 }
211218 downs = append (stmts , downs ... )
212219 }
213- // TODO: support windows line break
214- up := strings .Join (ups , "\n " )
215- down := strings .Join (downs , "\n " )
220+ up := createSQL (ups )
221+ down := createSQL (downs )
216222
217223 // TODO: support migration name
218224 name := "auto"
You can’t perform that action at this time.
0 commit comments