diff options
author | David Schneiderbauer <daviian@users.noreply.github.com> | 2017-10-08 13:08:18 +0200 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-10-08 19:08:18 +0800 |
commit | ebac051e7207181ac3d7bbe288536bf2224c9c0e (patch) | |
tree | 3622243563c05a11f7656fea8b3d31f726195fb5 /models/migrations/v38.go | |
parent | 92123fe82a2dc4c01fdc180baaa7d2bfa2fe971a (diff) | |
download | gitea-ebac051e7207181ac3d7bbe288536bf2224c9c0e.tar.gz gitea-ebac051e7207181ac3d7bbe288536bf2224c9c0e.zip |
Rewrite migrations to not depend on future code changes (#2604)
* v38 migration used an outdated version of RepoUnit model (#2602)
* change repoUnit model in migration
* fix v16 migration repo_unit table
* fix lint error
* move type definition inside function
Signed-off-by: David Schneiderbauer <dschneiderbauer@gmail.com>
* fix lint error
Signed-off-by: David Schneiderbauer <dschneiderbauer@gmail.com>
* Fix time tracking migration
* Refactor code
* Fix migration from Gogs
* v38 migration used an outdated version of RepoUnit model (#2602)
* change repoUnit model in migration
* fix v16 migration repo_unit table
* fix lint error
* move type definition inside function
Signed-off-by: David Schneiderbauer <dschneiderbauer@gmail.com>
* fix lint error
Signed-off-by: David Schneiderbauer <dschneiderbauer@gmail.com>
* Fix time tracking migration
* Refactor code
* Fix migration from Gogs
* add error check
Signed-off-by: David Schneiderbauer <dschneiderbauer@gmail.com>
* Additiomal fixes for migrations
* Fix timetracking migration
* Add back nil check
Diffstat (limited to 'models/migrations/v38.go')
-rw-r--r-- | models/migrations/v38.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/models/migrations/v38.go b/models/migrations/v38.go index c85688db78..6f66484b05 100644 --- a/models/migrations/v38.go +++ b/models/migrations/v38.go @@ -5,12 +5,26 @@ package migrations import ( + "time" + "code.gitea.io/gitea/models" + "github.com/go-xorm/core" "github.com/go-xorm/xorm" ) func removeCommitsUnitType(x *xorm.Engine) (err error) { + // RepoUnit describes all units of a repository + type RepoUnit struct { + ID int64 + RepoID int64 `xorm:"INDEX(s)"` + Type int `xorm:"INDEX(s)"` + Index int + Config core.Conversion `xorm:"TEXT"` + CreatedUnix int64 `xorm:"INDEX CREATED"` + Created time.Time `xorm:"-"` + } + // Update team unit types const batchSize = 100 for start := 0; ; start += batchSize { |