summaryrefslogtreecommitdiffstats
path: root/models/migrations
diff options
context:
space:
mode:
authorAntoine GIRARD <sapk@users.noreply.github.com>2017-11-29 00:35:23 +0100
committerLauris BH <lauris@nix.lv>2017-11-29 01:35:23 +0200
commit4035ab05fa2d2c8ec95d346fea91cab8211dab17 (patch)
tree623d09ee6ab41eba7307cb3be7ce176458455dab /models/migrations
parentc80d147fa911c2aa711bc3f310d7bef11681230b (diff)
downloadgitea-4035ab05fa2d2c8ec95d346fea91cab8211dab17.tar.gz
gitea-4035ab05fa2d2c8ec95d346fea91cab8211dab17.zip
Fix git lfs path (#3016)
* add suffix .git * Remove Content-Type on GET methods * Add migrations to force creation before any further potential migration
Diffstat (limited to 'models/migrations')
-rw-r--r--models/migrations/migrations.go4
-rw-r--r--models/migrations/v49.go31
2 files changed, 34 insertions, 1 deletions
diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go
index ba27568fd4..bccf6e6924 100644
--- a/models/migrations/migrations.go
+++ b/models/migrations/migrations.go
@@ -110,7 +110,7 @@ var migrations = []Migration{
NewMigration("add commit status table", addCommitStatus),
// v30 -> 31
NewMigration("add primary key to external login user", addExternalLoginUserPK),
- // 31 -> 32
+ // v31 -> 32
NewMigration("add field for login source synchronization", addLoginSourceSyncEnabledColumn),
// v32 -> v33
NewMigration("add units for team", addUnitsToRepoTeam),
@@ -146,6 +146,8 @@ var migrations = []Migration{
NewMigration("add deleted branches", addDeletedBranch),
// v48 -> v49
NewMigration("add repo indexer status", addRepoIndexerStatus),
+ // v49 -> v50
+ NewMigration("add lfs lock table", addLFSLock),
}
// Migrate database to current version
diff --git a/models/migrations/v49.go b/models/migrations/v49.go
new file mode 100644
index 0000000000..ab57d27de0
--- /dev/null
+++ b/models/migrations/v49.go
@@ -0,0 +1,31 @@
+// Copyright 2017 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"
+ "time"
+
+ "code.gitea.io/gitea/models"
+
+ "github.com/go-xorm/xorm"
+)
+
+func addLFSLock(x *xorm.Engine) error {
+ // LFSLock see models/lfs_lock.go
+ type LFSLock struct {
+ ID int64 `xorm:"pk autoincr"`
+ RepoID int64 `xorm:"INDEX NOT NULL"`
+ Owner *models.User `xorm:"-"`
+ OwnerID int64 `xorm:"INDEX NOT NULL"`
+ Path string `xorm:"TEXT"`
+ Created time.Time `xorm:"created"`
+ }
+
+ if err := x.Sync2(new(LFSLock)); err != nil {
+ return fmt.Errorf("Sync2: %v", err)
+ }
+ return nil
+}