summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2024-05-09 21:59:01 +0200
committerxengineering <me@xengineering.eu>2024-05-09 21:59:01 +0200
commite5d57f2c4a9f01ac7a2b11c04b932311bd240611 (patch)
tree59ef53b049080aec7e73bb9d180c5e002d17702c
parentca96df29085f9ca6567cd474d0920e48c6410b42 (diff)
downloadceres-e5d57f2c4a9f01ac7a2b11c04b932311bd240611.tar
ceres-e5d57f2c4a9f01ac7a2b11c04b932311bd240611.tar.zst
ceres-e5d57f2c4a9f01ac7a2b11c04b932311bd240611.zip
model: Migrate only in empty databases
-rw-r--r--model/database.go18
1 files changed, 10 insertions, 8 deletions
diff --git a/model/database.go b/model/database.go
index cdded4a..8e002d6 100644
--- a/model/database.go
+++ b/model/database.go
@@ -101,16 +101,18 @@ func MigrateDatabase(version string) {
if err != nil {
log.Fatalf("Failed to setup minimal database schema: %v", err)
}
- }
- query, err := GetSql(`migrate`)
- if err != nil {
- log.Fatal(err)
- }
- _, err = tx.Exec(query)
- if err != nil {
- return err
+ log.Println("Executing initial migration")
+ query, err := GetSql(`migrate`)
+ if err != nil {
+ log.Fatal(err)
+ }
+ _, err = tx.Exec(query)
+ if err != nil {
+ return err
+ }
}
+
return nil
})
if err != nil {