mirror of
1
Fork 0

[DB] forgejo migration v2: create the forgejo_sem_ver table

(cherry picked from commit 86b26436af)
(cherry picked from commit 479cba59ac)
(cherry picked from commit 4765f9a889)
(cherry picked from commit af771410bf)
(cherry picked from commit d1ea9305d8)
(cherry picked from commit f77e1bb7ab)
(cherry picked from commit 0b95f8fe89)
(cherry picked from commit 4f8fb2390a)
(cherry picked from commit 8ea0e22ff6)
(cherry picked from commit 43ac19ac59)
(cherry picked from commit 0d2f63df4f)
(cherry picked from commit d02a8036fd)
(cherry picked from commit 1fe4c7db94)
(cherry picked from commit d641cdeaf0)
(cherry picked from commit 10e8a4f8b8)
(cherry picked from commit 8097bc40b3)
(cherry picked from commit ee5cb37d7e)
(cherry picked from commit 26d93b8e49)
(cherry picked from commit bc73195e59)
This commit is contained in:
Earl Warren 2023-08-08 23:52:37 +02:00
parent 2c89d7f18c
commit a763fa5de2
No known key found for this signature in database
GPG Key ID: 0579CB2928A78A00
2 changed files with 20 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import (
"fmt" "fmt"
"os" "os"
forgejo_v1_20 "code.gitea.io/gitea/models/forgejo_migrations/v1_20"
"code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/setting"
@ -34,7 +35,10 @@ func NewMigration(desc string, fn func(*xorm.Engine) error) *Migration {
// This is a sequence of additional Forgejo migrations. // This is a sequence of additional Forgejo migrations.
// Add new migrations to the bottom of the list. // Add new migrations to the bottom of the list.
var migrations = []*Migration{} var migrations = []*Migration{
// v1 -> v2
NewMigration("create the forgejo_sem_ver table", forgejo_v1_20.CreateSemVerTable),
}
// GetCurrentDBVersion returns the current Forgejo database version. // GetCurrentDBVersion returns the current Forgejo database version.
func GetCurrentDBVersion(x *xorm.Engine) (int64, error) { func GetCurrentDBVersion(x *xorm.Engine) (int64, error) {

View File

@ -0,0 +1,15 @@
// SPDX-License-Identifier: MIT
package forgejo_v1_20 //nolint:revive
import (
"xorm.io/xorm"
)
func CreateSemVerTable(x *xorm.Engine) error {
type ForgejoSemVer struct {
Version string
}
return x.Sync(new(ForgejoSemVer))
}