[DB] forgejo migration v2: create the forgejo_sem_ver table

This commit is contained in:
Earl Warren 2023-08-08 23:52:37 +02:00
parent ec8003859c
commit 86b26436af
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"
"os"
forgejo_v1_20 "code.gitea.io/gitea/models/forgejo_migrations/v1_20"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"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.
// Add new migrations to the bottom of the list.
var migrations = []*Migration{}
var migrations = []*Migration{
// v2 -> v3
NewMigration("create the forgejo_sem_ver table", forgejo_v1_20.CreateSemVerTable),
}
// GetCurrentDBVersion returns the current Forgejo database version.
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))
}