mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-22 20:53:40 +09:00
chore(db): introduce db.Session and db.EngineMigration interfaces (#37746)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: wxiaoguang <2114189+wxiaoguang@users.noreply.github.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
co-authored by
copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
wxiaoguang
wxiaoguang
parent
d9149d8a0a
commit
94e3482d1a
@@ -3,11 +3,9 @@
|
||||
|
||||
package v1_7
|
||||
|
||||
import (
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
import "code.gitea.io/gitea/models/db"
|
||||
|
||||
func AddMustChangePassword(x *xorm.Engine) error {
|
||||
func AddMustChangePassword(x db.EngineMigration) error {
|
||||
// User see models/user.go
|
||||
type User struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
|
||||
package v1_7
|
||||
|
||||
import "xorm.io/xorm"
|
||||
import "code.gitea.io/gitea/models/db"
|
||||
|
||||
func AddApprovalWhitelistsToProtectedBranches(x *xorm.Engine) error {
|
||||
func AddApprovalWhitelistsToProtectedBranches(x db.EngineMigration) error {
|
||||
type ProtectedBranch struct {
|
||||
ApprovalsWhitelistUserIDs []int64 `xorm:"JSON TEXT"`
|
||||
ApprovalsWhitelistTeamIDs []int64 `xorm:"JSON TEXT"`
|
||||
|
||||
@@ -4,11 +4,12 @@
|
||||
package v1_7
|
||||
|
||||
import (
|
||||
"code.gitea.io/gitea/models/db"
|
||||
|
||||
"xorm.io/builder"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func ClearNonusedData(x *xorm.Engine) error {
|
||||
func ClearNonusedData(x db.EngineMigration) error {
|
||||
condDelete := func(colName string) builder.Cond {
|
||||
return builder.NotIn(colName, builder.Select("id").From("`user`"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user