Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split migrations folder #21549

Merged
merged 25 commits into from
Nov 2, 2022
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a9d7856
Split migrations folder
lunny Oct 22, 2022
69fb254
Fix import sequence
lunny Oct 22, 2022
38e5ab5
Fix lint
lunny Oct 22, 2022
19981a3
Merge branch 'main' into lunny/split_migrations
lunny Oct 22, 2022
49793c1
merge main branch
lunny Oct 22, 2022
3a01c59
Merge branch 'main' into lunny/split_migrations
lunny Oct 23, 2022
c6d5d47
Fix generating licenses
lunny Oct 23, 2022
d48ab36
Fix fmt
lunny Oct 23, 2022
78b19b5
Merge branch 'main' into lunny/split_migrations
lunny Oct 23, 2022
e51a89f
Fix test
lunny Oct 23, 2022
072abe6
Merge branch 'main' into lunny/split_migrations
lunny Oct 23, 2022
6f5ebeb
merge main branch
lunny Oct 25, 2022
c530817
Fix test
lunny Oct 26, 2022
4157dd9
Merge branch 'main' into lunny/split_migrations
lunny Oct 26, 2022
b5dbbc9
Fix test
lunny Oct 26, 2022
4e4762f
Fix migration tests
lunny Oct 27, 2022
77fcbff
Merge branch 'main' into lunny/split_migrations
lunny Oct 27, 2022
7d3c3ea
Merge branch 'main' into lunny/split_migrations
lunny Oct 28, 2022
c2d3826
Merge branch 'main' into lunny/split_migrations
lunny Oct 28, 2022
583a581
merge main branch
lunny Oct 29, 2022
7638cd2
Merge branch 'lunny/split_migrations' of github.com:lunny/gitea into …
lunny Oct 29, 2022
2320285
Merge branch 'main' into lunny/split_migrations
lunny Oct 31, 2022
f2456d2
Merge branch 'main' into lunny/split_migrations
lunny Oct 31, 2022
4c3e1dd
Merge branch 'main' into lunny/split_migrations
lunny Nov 1, 2022
5b7c76c
Merge branch 'main' into lunny/split_migrations
lunny Nov 2, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
merge main branch
lunny committed Oct 22, 2022
commit 49793c187aeadfe464eb4c9c4d73b10441013676
2 changes: 2 additions & 0 deletions models/migrations/migrations.go
Original file line number Diff line number Diff line change
@@ -426,6 +426,8 @@ var migrations = []Migration{
NewMigration("Create key/value table for system settings", v1_18.CreateSystemSettingsTable),
// v228 -> v229
NewMigration("Add TeamInvite table", v1_18.AddTeamInviteTable),
// v229 -> v230
NewMigration("Update counts of all open milestones", v1_18.UpdateOpenMilestoneCounts),
}

// GetCurrentDBVersion returns the current db version
4 changes: 2 additions & 2 deletions models/migrations/v229.go → models/migrations/v1_18/v229.go
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.

package migrations
package v1_18 //nolint

import (
"fmt"
@@ -13,7 +13,7 @@ import (
"xorm.io/xorm"
)

func updateOpenMilestoneCounts(x *xorm.Engine) error {
func UpdateOpenMilestoneCounts(x *xorm.Engine) error {
var openMilestoneIDs []int64
err := x.Table("milestone").Select("id").Where(builder.Neq{"is_closed": 1}).Find(&openMilestoneIDs)
if err != nil {
Original file line number Diff line number Diff line change
@@ -2,12 +2,13 @@
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.

package migrations
package v1_18 //nolint

import (
"testing"

"code.gitea.io/gitea/models/issues"
"code.gitea.io/gitea/models/migrations/base"

"github.com/stretchr/testify/assert"
)
@@ -16,13 +17,13 @@ func Test_updateOpenMilestoneCounts(t *testing.T) {
type ExpectedMilestone issues.Milestone

// Prepare and load the testing database
x, deferable := prepareTestEnv(t, 0, new(issues.Milestone), new(ExpectedMilestone), new(issues.Issue))
x, deferable := base.PrepareTestEnv(t, 0, new(issues.Milestone), new(ExpectedMilestone), new(issues.Issue))
defer deferable()
if x == nil || t.Failed() {
return
}

if err := updateOpenMilestoneCounts(x); err != nil {
if err := UpdateOpenMilestoneCounts(x); err != nil {
assert.NoError(t, err)
return
}
You are viewing a condensed version of this merge commit. You can view the full changes here.