aboutsummaryrefslogtreecommitdiffstats
path: root/models/models.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/models.go')
-rw-r--r--models/models.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/models/models.go b/models/models.go
index c818c65100..7f12d6260a 100644
--- a/models/models.go
+++ b/models/models.go
@@ -182,6 +182,10 @@ func SetEngine() (err error) {
}
// NewEngine initializes a new xorm.Engine
+// This function must never call .Sync2() if the provided migration function fails.
+// When called from the "doctor" command, the migration function is a version check
+// that prevents the doctor from fixing anything in the database if the migration level
+// is different from the expected value.
func NewEngine(ctx context.Context, migrateFunc func(*xorm.Engine) error) (err error) {
if err = SetEngine(); err != nil {
return err