mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-06 03:06:44 +02:00
Some checks failed
/ release (push) Waiting to run
testing-integration / test-unit (push) Waiting to run
testing-integration / test-sqlite (push) Waiting to run
testing / backend-checks (push) Waiting to run
testing / frontend-checks (push) Waiting to run
testing / test-unit (push) Blocked by required conditions
testing / test-e2e (push) Blocked by required conditions
testing / test-remote-cacher (redis) (push) Blocked by required conditions
testing / test-remote-cacher (valkey) (push) Blocked by required conditions
testing / test-remote-cacher (garnet) (push) Blocked by required conditions
testing / test-remote-cacher (redict) (push) Blocked by required conditions
testing / test-mysql (push) Blocked by required conditions
testing / test-pgsql (push) Blocked by required conditions
testing / test-sqlite (push) Blocked by required conditions
testing / security-check (push) Blocked by required conditions
Integration tests for the release process / release-simulation (push) Has been cancelled
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8422 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org> Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.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/migrations/base"
|
|
|
|
"xorm.io/xorm"
|
|
"xorm.io/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()
|
|
}
|