summaryrefslogtreecommitdiff
path: root/model
diff options
context:
space:
mode:
Diffstat (limited to 'model')
-rw-r--r--model/database.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/model/database.go b/model/database.go
index d6d6c16..3953c92 100644
--- a/model/database.go
+++ b/model/database.go
@@ -58,13 +58,12 @@ func Transaction(f func(*sql.Tx) error) error {
}
func MigrateDatabase() {
- query, err := GetSql(`migrate`)
- if err != nil {
- log.Fatal(err)
- }
-
- err = Transaction(func(tx *sql.Tx) error {
- _, err := tx.Exec(query)
+ err := Transaction(func(tx *sql.Tx) error {
+ query, err := GetSql(`migrate`)
+ if err != nil {
+ log.Fatal(err)
+ }
+ _, err = tx.Exec(query)
if err != nil {
return err
}