mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-07-25 02:48:05 +00:00
Upgrade Forgejo to our forked [xorm v1.4.0](https://code.forgejo.org/xorm/xorm/compare/v1.3.9-forgejo.12...v1.4.0), which is now named `code.forgejo.org/xorm/xorm` to reflect the current expectation that it is a permanent fork. A small number of API changes were made recently in https://code.forgejo.org/xorm/xorm/issues/120 which are accounted for in this PR, in addition to the module rename. ## Checklist The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. All work and communication must conform to Forgejo's [AI Agreement](https://codeberg.org/forgejo/governance/src/branch/main/AIAgreement.md). There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org). ### Documentation - [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change. - [x] I did not document these changes and I do not expect someone else to do it. ### Release notes - [ ] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change. - [x] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12639 Reviewed-by: Otto <otto@codeberg.org>
60 lines
1.2 KiB
Go
60 lines
1.2 KiB
Go
// Copyright 2025 The Forgejo Authors.
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
package v1_23
|
|
|
|
import (
|
|
"forgejo.org/models/gitea_migrations/base"
|
|
|
|
"code.forgejo.org/xorm/xorm"
|
|
"code.forgejo.org/xorm/xorm/schemas"
|
|
)
|
|
|
|
func GiteaLastDrop(x *xorm.Engine) error {
|
|
tables, err := x.DBMetas()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
sess := x.NewSession()
|
|
defer sess.Close()
|
|
|
|
for _, drop := range []struct {
|
|
table string
|
|
column string
|
|
}{
|
|
{"badge", "slug"},
|
|
{"oauth2_application", "skip_secondary_authorization"},
|
|
{"repository", "default_wiki_branch"},
|
|
{"repo_unit", "everyone_access_mode"},
|
|
{"protected_branch", "can_force_push"},
|
|
{"protected_branch", "enable_force_push_allowlist"},
|
|
{"protected_branch", "force_push_allowlist_user_i_ds"},
|
|
{"protected_branch", "force_push_allowlist_team_i_ds"},
|
|
{"protected_branch", "force_push_allowlist_deploy_keys"},
|
|
} {
|
|
var table *schemas.Table
|
|
found := false
|
|
|
|
for _, table = range tables {
|
|
if table.Name == drop.table {
|
|
found = true
|
|
break
|
|
}
|
|
}
|
|
|
|
if !found {
|
|
continue
|
|
}
|
|
|
|
if table.GetColumn(drop.column) == nil {
|
|
continue
|
|
}
|
|
|
|
if err := base.DropTableColumns(sess, drop.table, drop.column); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
return sess.Commit()
|
|
}
|