Skip to content

Commit fcdc57d

Browse files
authored
Fix wrong table name (#30557) (#30652)
Backport #30557 The table name should be `oauth2_application` but `o_auth2_application` Caused by https://github.com/go-gitea/gitea/pull/21316/files#diff-9610efbc608a41f1f2eaff5790423f0a187906f6ff0beb23a5e8d18366cc2ccfR38
1 parent f394cd7 commit fcdc57d

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

models/auth/oauth2_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ import (
1313
"github.com/stretchr/testify/assert"
1414
)
1515

16-
//////////////////// Application
17-
1816
func TestOAuth2Application_GenerateClientSecret(t *testing.T) {
1917
assert.NoError(t, unittest.PrepareTestDatabase())
2018
app := unittest.AssertExistsAndLoadBean(t, &auth_model.OAuth2Application{ID: 1})

models/migrations/v1_18/v230.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import (
99

1010
// AddConfidentialColumnToOAuth2ApplicationTable: add ConfidentialClient column, setting existing rows to true
1111
func AddConfidentialClientColumnToOAuth2ApplicationTable(x *xorm.Engine) error {
12-
type OAuth2Application struct {
12+
type oauth2Application struct {
13+
ID int64
1314
ConfidentialClient bool `xorm:"NOT NULL DEFAULT TRUE"`
1415
}
15-
16-
return x.Sync(new(OAuth2Application))
16+
return x.Sync(new(oauth2Application))
1717
}

models/migrations/v1_18/v230_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ import (
1313

1414
func Test_AddConfidentialClientColumnToOAuth2ApplicationTable(t *testing.T) {
1515
// premigration
16-
type OAuth2Application struct {
16+
type oauth2Application struct {
1717
ID int64
1818
}
1919

2020
// Prepare and load the testing database
21-
x, deferable := base.PrepareTestEnv(t, 0, new(OAuth2Application))
21+
x, deferable := base.PrepareTestEnv(t, 0, new(oauth2Application))
2222
defer deferable()
2323
if x == nil || t.Failed() {
2424
return
@@ -36,7 +36,7 @@ func Test_AddConfidentialClientColumnToOAuth2ApplicationTable(t *testing.T) {
3636
}
3737

3838
got := []ExpectedOAuth2Application{}
39-
if err := x.Table("o_auth2_application").Select("id, confidential_client").Find(&got); !assert.NoError(t, err) {
39+
if err := x.Table("oauth2_application").Select("id, confidential_client").Find(&got); !assert.NoError(t, err) {
4040
return
4141
}
4242

0 commit comments

Comments
 (0)