summaryrefslogtreecommitdiffstats
path: root/models/migrations
diff options
context:
space:
mode:
authorPeter Smit <peter@smitmail.eu>2015-01-22 15:01:45 +0200
committerPeter Smit <peter@smitmail.eu>2015-01-22 15:01:45 +0200
commit4ef32454138a40c8b3cc5334c8980e71bd431825 (patch)
tree19a7172e1781ccbebe6e40051d0c06cf7f37e6e6 /models/migrations
parent2a70d6b7235a124027ebc446d8559b4596cb6dcd (diff)
downloadgitea-4ef32454138a40c8b3cc5334c8980e71bd431825.tar.gz
gitea-4ef32454138a40c8b3cc5334c8980e71bd431825.zip
Migration code: errors are not to be forgotten
Diffstat (limited to 'models/migrations')
-rw-r--r--models/migrations/migrations.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go
index e51bc3c876..3586e5d0b6 100644
--- a/models/migrations/migrations.go
+++ b/models/migrations/migrations.go
@@ -20,7 +20,9 @@ var migrations = []migration{}
// Migrate database to current version
func Migrate(x *xorm.Engine) error {
- x.Sync(new(Version))
+ if err := x.Sync(new(Version)); err != nil {
+ return err
+ }
currentVersion := &Version{Id: 1}
has, err := x.Get(currentVersion)
@@ -39,7 +41,9 @@ func Migrate(x *xorm.Engine) error {
return err
}
currentVersion.Version = v + int64(i) + 1
- x.Id(1).Update(currentVersion)
+ if _, err = x.Id(1).Update(currentVersion); err != nil {
+ return err
+ }
}
return nil
}