forked from mattes/migrate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Multiple statements per migration file
Makes it possible to run several queries in each file.
- Loading branch information
Showing
2 changed files
with
15 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ package cassandra | |
|
||
import ( | ||
"net/url" | ||
"strings" | ||
"time" | ||
|
||
"github.com/gocql/gocql" | ||
|
@@ -120,7 +121,16 @@ func (driver *Driver) Migrate(f file.File, pipe chan interface{}) { | |
return | ||
} | ||
|
||
err = driver.session.Query(string(f.Content)).Exec() | ||
for _, query := range strings.Split(string(f.Content), ";") { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
balboah
Author
Owner
|
||
query = strings.TrimSpace(query) | ||
if len(query) == 0 { | ||
continue | ||
} | ||
|
||
if err = driver.session.Query(query).Exec(); err != nil { | ||
return | ||
} | ||
} | ||
} | ||
|
||
func (driver *Driver) Version() (uint64, error) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Using
;
probably relates to this issue? Haven't found a better solution yet. What do you think?