mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-25 11:16:11 +01:00
[DB] forgejo migration v2: create the forgejo_sem_ver table
(cherry picked from commit86b26436af
) (cherry picked from commit479cba59ac
) (cherry picked from commit4765f9a889
) (cherry picked from commitaf771410bf
) (cherry picked from commitd1ea9305d8
)
This commit is contained in:
parent
fb2759b6af
commit
f77e1bb7ab
|
@ -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) {
|
||||||
|
|
15
models/forgejo_migrations/v1_20/v2.go
Normal file
15
models/forgejo_migrations/v1_20/v2.go
Normal 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))
|
||||||
|
}
|
Loading…
Reference in a new issue