summaryrefslogtreecommitdiffstats
path: root/models/migrations
diff options
context:
space:
mode:
authorAllen Wild <aswild@users.noreply.github.com>2018-03-27 10:13:20 -0400
committerLunny Xiao <xiaolunwen@gmail.com>2018-03-27 22:13:20 +0800
commit15c6bb500b8b395ab7ca61498f5415b9f583213c (patch)
tree5832b47e529ea73d3421161ed17dcebdb29f721b /models/migrations
parent321cc2a3d0f267f8b0f5bb4365572636f1ce0443 (diff)
downloadgitea-15c6bb500b8b395ab7ca61498f5415b9f583213c.tar.gz
gitea-15c6bb500b8b395ab7ca61498f5415b9f583213c.zip
Add repository setting to enable/disable health checks (#3607)
New Feature: * Repository struct field for IsFsckEnabled (default true of course) * Admin Settings section on repo options page, accessible only by admin users Possible Enhancements: * There's no way to force running health checks on all repos regardless of their IsFsckEnabled setting. This would be useful if there were an admin API or dashboard button to run fsck immediately. Issue: https://github.com/go-gitea/gitea/issues/1712 Signed-off-by: Allen Wild <allenwild93@gmail.com>
Diffstat (limited to 'models/migrations')
-rw-r--r--models/migrations/migrations.go2
-rw-r--r--models/migrations/v60.go22
2 files changed, 24 insertions, 0 deletions
diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go
index 6c3404bcd7..36c84a61aa 100644
--- a/models/migrations/migrations.go
+++ b/models/migrations/migrations.go
@@ -172,6 +172,8 @@ var migrations = []Migration{
NewMigration("add label descriptions", addLabelsDescriptions),
// v59 -> v60
NewMigration("add merge whitelist for protected branches", addProtectedBranchMergeWhitelist),
+ // v60 -> v61
+ NewMigration("add is_fsck_enabled column for repos", addFsckEnabledToRepo),
}
// Migrate database to current version
diff --git a/models/migrations/v60.go b/models/migrations/v60.go
new file mode 100644
index 0000000000..13ec38241a
--- /dev/null
+++ b/models/migrations/v60.go
@@ -0,0 +1,22 @@
+// Copyright 2018 The Gitea Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+package migrations
+
+import (
+ "fmt"
+
+ "github.com/go-xorm/xorm"
+)
+
+func addFsckEnabledToRepo(x *xorm.Engine) error {
+ type Repository struct {
+ IsFsckEnabled bool `xorm:"NOT NULL DEFAULT true"`
+ }
+
+ if err := x.Sync2(new(Repository)); err != nil {
+ return fmt.Errorf("Sync2: %v", err)
+ }
+ return nil
+}