This commit is contained in:
@@ -7,14 +7,13 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/gitrepo"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"gitea.dev/models/db"
|
||||
repo_model "gitea.dev/models/repo"
|
||||
"gitea.dev/modules/git"
|
||||
"gitea.dev/modules/gitrepo"
|
||||
)
|
||||
|
||||
func FixReleaseSha1OnReleaseTable(ctx context.Context, x *xorm.Engine) error {
|
||||
func FixReleaseSha1OnReleaseTable(ctx context.Context, x db.EngineMigration) error {
|
||||
type Release struct {
|
||||
ID int64
|
||||
RepoID int64
|
||||
|
||||
@@ -4,12 +4,11 @@
|
||||
package v1_9
|
||||
|
||||
import (
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"gitea.dev/models/db"
|
||||
"gitea.dev/modules/timeutil"
|
||||
)
|
||||
|
||||
func AddUploaderIDForAttachment(x *xorm.Engine) error {
|
||||
func AddUploaderIDForAttachment(x db.EngineMigration) error {
|
||||
type Attachment struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
UUID string `xorm:"uuid UNIQUE"`
|
||||
|
||||
@@ -3,11 +3,9 @@
|
||||
|
||||
package v1_9
|
||||
|
||||
import (
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
import "gitea.dev/models/db"
|
||||
|
||||
func AddGPGKeyImport(x *xorm.Engine) error {
|
||||
func AddGPGKeyImport(x db.EngineMigration) error {
|
||||
type GPGKeyImport struct {
|
||||
KeyID string `xorm:"pk CHAR(16) NOT NULL"`
|
||||
Content string `xorm:"TEXT NOT NULL"`
|
||||
|
||||
@@ -6,15 +6,14 @@ package v1_9
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"code.gitea.io/gitea/models/migrations/base"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"gitea.dev/models/db"
|
||||
"gitea.dev/models/migrations/base"
|
||||
"gitea.dev/modules/log"
|
||||
"gitea.dev/modules/timeutil"
|
||||
"gitea.dev/modules/util"
|
||||
)
|
||||
|
||||
func HashAppToken(x *xorm.Engine) error {
|
||||
func HashAppToken(x db.EngineMigration) error {
|
||||
// AccessToken see models/token.go
|
||||
type AccessToken struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
@@ -65,10 +64,7 @@ func HashAppToken(x *xorm.Engine) error {
|
||||
|
||||
for _, token := range tokens {
|
||||
// generate salt
|
||||
salt, err := util.CryptoRandomString(10)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
salt := util.CryptoRandomString(10)
|
||||
token.TokenSalt = salt
|
||||
token.TokenHash = base.HashToken(token.Sha1, salt)
|
||||
if len(token.Sha1) < 8 {
|
||||
@@ -101,7 +97,7 @@ func HashAppToken(x *xorm.Engine) error {
|
||||
return resyncHashAppTokenWithUniqueHash(x)
|
||||
}
|
||||
|
||||
func resyncHashAppTokenWithUniqueHash(x *xorm.Engine) error {
|
||||
func resyncHashAppTokenWithUniqueHash(x db.EngineMigration) error {
|
||||
// AccessToken see models/token.go
|
||||
type AccessToken struct {
|
||||
TokenHash string `xorm:"UNIQUE"` // sha256 of token - we will ensure UNIQUE later
|
||||
|
||||
@@ -3,11 +3,9 @@
|
||||
|
||||
package v1_9
|
||||
|
||||
import (
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
import "gitea.dev/models/db"
|
||||
|
||||
func AddHTTPMethodToWebhook(x *xorm.Engine) error {
|
||||
func AddHTTPMethodToWebhook(x db.EngineMigration) error {
|
||||
type Webhook struct {
|
||||
HTTPMethod string `xorm:"http_method DEFAULT 'POST'"`
|
||||
}
|
||||
|
||||
@@ -3,11 +3,9 @@
|
||||
|
||||
package v1_9
|
||||
|
||||
import (
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
import "gitea.dev/models/db"
|
||||
|
||||
func AddAvatarFieldToRepository(x *xorm.Engine) error {
|
||||
func AddAvatarFieldToRepository(x db.EngineMigration) error {
|
||||
type Repository struct {
|
||||
// ID(10-20)-md5(32) - must fit into 64 symbols
|
||||
Avatar string `xorm:"VARCHAR(64)"`
|
||||
|
||||
Reference in New Issue
Block a user