loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix wrong table name (#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

(cherry picked from commit e94864e86c43f435af7e1fc3c4831a4cc0a3e981)

Conflicts:
models/migrations/migrations.go
trivial context conflict because
Allow everyone to read or write a wiki by a repo unit setting (#30495)
was skipped.

authored by

Lunny Xiao and committed by
Earl Warren
4f73382e b9891088

+18 -8
-2
models/auth/oauth2_test.go
··· 16 16 "github.com/stretchr/testify/assert" 17 17 ) 18 18 19 - //////////////////// Application 20 - 21 19 func TestOAuth2Application_GenerateClientSecret(t *testing.T) { 22 20 assert.NoError(t, unittest.PrepareTestDatabase()) 23 21 app := unittest.AssertExistsAndLoadBean(t, &auth_model.OAuth2Application{ID: 1})
models/migrations/fixtures/Test_AddConfidentialClientColumnToOAuth2ApplicationTable/o_auth2_application.yml models/migrations/fixtures/Test_AddConfidentialClientColumnToOAuth2ApplicationTable/oauth2_application.yml
+2
models/migrations/migrations.go
··· 586 586 NewMigration("Add missing field of commit status summary table", v1_23.AddCommitStatusSummary2), 587 587 // v297 -> v298 588 588 NewMigration("Add everyone_access_mode for repo_unit", noopMigration), 589 + // v298 -> v299 590 + NewMigration("Drop wrongly created table o_auth2_application", v1_23.DropWronglyCreatedTable), 589 591 } 590 592 591 593 // GetCurrentDBVersion returns the current db version
+3 -3
models/migrations/v1_18/v230.go
··· 9 9 10 10 // AddConfidentialColumnToOAuth2ApplicationTable: add ConfidentialClient column, setting existing rows to true 11 11 func AddConfidentialClientColumnToOAuth2ApplicationTable(x *xorm.Engine) error { 12 - type OAuth2Application struct { 12 + type oauth2Application struct { 13 + ID int64 13 14 ConfidentialClient bool `xorm:"NOT NULL DEFAULT TRUE"` 14 15 } 15 - 16 - return x.Sync(new(OAuth2Application)) 16 + return x.Sync(new(oauth2Application)) 17 17 }
+3 -3
models/migrations/v1_18/v230_test.go
··· 13 13 14 14 func Test_AddConfidentialClientColumnToOAuth2ApplicationTable(t *testing.T) { 15 15 // premigration 16 - type OAuth2Application struct { 16 + type oauth2Application struct { 17 17 ID int64 18 18 } 19 19 20 20 // Prepare and load the testing database 21 - x, deferable := base.PrepareTestEnv(t, 0, new(OAuth2Application)) 21 + x, deferable := base.PrepareTestEnv(t, 0, new(oauth2Application)) 22 22 defer deferable() 23 23 if x == nil || t.Failed() { 24 24 return ··· 36 36 } 37 37 38 38 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) { 40 40 return 41 41 } 42 42
+10
models/migrations/v1_23/v298.go
··· 1 + // Copyright 2024 The Gitea Authors. All rights reserved. 2 + // SPDX-License-Identifier: MIT 3 + 4 + package v1_23 //nolint 5 + 6 + import "xorm.io/xorm" 7 + 8 + func DropWronglyCreatedTable(x *xorm.Engine) error { 9 + return x.DropTables("o_auth2_application") 10 + }