diff options
author | xengineering <me@xengineering.eu> | 2024-05-09 21:59:01 +0200 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2024-05-09 21:59:01 +0200 |
commit | e5d57f2c4a9f01ac7a2b11c04b932311bd240611 (patch) | |
tree | 59ef53b049080aec7e73bb9d180c5e002d17702c | |
parent | ca96df29085f9ca6567cd474d0920e48c6410b42 (diff) | |
download | ceres-e5d57f2c4a9f01ac7a2b11c04b932311bd240611.tar ceres-e5d57f2c4a9f01ac7a2b11c04b932311bd240611.tar.zst ceres-e5d57f2c4a9f01ac7a2b11c04b932311bd240611.zip |
model: Migrate only in empty databases
-rw-r--r-- | model/database.go | 18 |
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 { |