summaryrefslogtreecommitdiffstats
path: root/store/sql_upgrade.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-04-03 13:32:58 -0400
committerCorey Hulen <corey@hulen.com>2017-04-03 10:32:58 -0700
commit6b61834ab14e9a4e51c29dd2904a1332c327aae6 (patch)
tree283122751e3e8c13cc058c4c575fd0e6d7a7549e /store/sql_upgrade.go
parente49f5928c55ba57c39efa11c568c66342b962aae (diff)
downloadchat-6b61834ab14e9a4e51c29dd2904a1332c327aae6.tar.gz
chat-6b61834ab14e9a4e51c29dd2904a1332c327aae6.tar.bz2
chat-6b61834ab14e9a4e51c29dd2904a1332c327aae6.zip
Add store unit tests and add make target for testing store with postgres (#5925)
* Add store unit tests and add make target for testing store with postgres * Remove postgres target form test-server target * Fix audit test
Diffstat (limited to 'store/sql_upgrade.go')
-rw-r--r--store/sql_upgrade.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/store/sql_upgrade.go b/store/sql_upgrade.go
index 45981c5c8..551a021ec 100644
--- a/store/sql_upgrade.go
+++ b/store/sql_upgrade.go
@@ -47,7 +47,7 @@ func UpgradeDatabase(sqlStore *SqlStore) {
// If the SchemaVersion is empty this this is the first time it has ran
// so lets set it to the current version.
if sqlStore.SchemaVersion == "" {
- if result := <-sqlStore.system.Save(&model.System{Name: "Version", Value: model.CurrentVersion}); result.Err != nil {
+ if result := <-sqlStore.system.SaveOrUpdate(&model.System{Name: "Version", Value: model.CurrentVersion}); result.Err != nil {
l4g.Critical(result.Err.Error())
time.Sleep(time.Second)
os.Exit(EXIT_VERSION_SAVE_MISSING)
@@ -66,7 +66,7 @@ func UpgradeDatabase(sqlStore *SqlStore) {
}
func saveSchemaVersion(sqlStore *SqlStore, version string) {
- if result := <-sqlStore.system.Update(&model.System{Name: "Version", Value: model.CurrentVersion}); result.Err != nil {
+ if result := <-sqlStore.system.Update(&model.System{Name: "Version", Value: version}); result.Err != nil {
l4g.Critical(result.Err.Error())
time.Sleep(time.Second)
os.Exit(EXIT_VERSION_SAVE)