mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-09-20 21:03:41 +00:00
Cleanup columns in forges table (#5517)
This commit is contained in:
@@ -30,8 +30,8 @@ type Forge struct {
|
|||||||
ID int64 `json:"id" xorm:"pk autoincr 'id'"`
|
ID int64 `json:"id" xorm:"pk autoincr 'id'"`
|
||||||
Type ForgeType `json:"type" xorm:"VARCHAR(250)"`
|
Type ForgeType `json:"type" xorm:"VARCHAR(250)"`
|
||||||
URL string `json:"url" xorm:"VARCHAR(500) 'url'"`
|
URL string `json:"url" xorm:"VARCHAR(500) 'url'"`
|
||||||
OAuthClientID string `json:"client,omitempty" xorm:"VARCHAR(250)"`
|
OAuthClientID string `json:"client,omitempty" xorm:"VARCHAR(250) 'oauth_client_id'"`
|
||||||
OAuthClientSecret string `json:"-" xorm:"VARCHAR(250)"` // do not expose client secret
|
OAuthClientSecret string `json:"-" xorm:"VARCHAR(250) 'oauth_client_secret'"` // do not expose client secret
|
||||||
SkipVerify bool `json:"skip_verify,omitempty" xorm:"bool"`
|
SkipVerify bool `json:"skip_verify,omitempty" xorm:"bool"`
|
||||||
OAuthHost string `json:"oauth_host,omitempty" xorm:"VARCHAR(250) 'oauth_host'"` // public url for oauth if different from url
|
OAuthHost string `json:"oauth_host,omitempty" xorm:"VARCHAR(250) 'oauth_host'"` // public url for oauth if different from url
|
||||||
AdditionalOptions map[string]any `json:"additional_options,omitempty" xorm:"json"`
|
AdditionalOptions map[string]any `json:"additional_options,omitempty" xorm:"json"`
|
||||||
|
25
server/store/datastore/migration/027_fix_forge_columns.go
Normal file
25
server/store/datastore/migration/027_fix_forge_columns.go
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
package migration
|
||||||
|
|
||||||
|
import (
|
||||||
|
"src.techknowlogick.com/xormigrate"
|
||||||
|
"xorm.io/xorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
var fixForgeColumns = xormigrate.Migration{
|
||||||
|
ID: "fix-forge-columns",
|
||||||
|
MigrateSession: func(sess *xorm.Session) (err error) {
|
||||||
|
if err := renameColumn(sess, "forges", "o_auth_client_i_d", "oauth_client_id"); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := renameColumn(sess, "forges", "o_auth_client_secret", "oauth_client_secret"); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Drop client and client_secret columns if they still exist
|
||||||
|
if err := dropTableColumns(sess, "forges", "client", "client_secret"); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
@@ -54,6 +54,7 @@ var migrationTasks = []*xormigrate.Migration{
|
|||||||
&removeRepoScm,
|
&removeRepoScm,
|
||||||
&unsanitizeOrgAndUserNames,
|
&unsanitizeOrgAndUserNames,
|
||||||
&replaceZeroForgeIDsInOrgs,
|
&replaceZeroForgeIDsInOrgs,
|
||||||
|
&fixForgeColumns,
|
||||||
}
|
}
|
||||||
|
|
||||||
var allBeans = []any{
|
var allBeans = []any{
|
||||||
|
Binary file not shown.
Reference in New Issue
Block a user