From 26d93b8e49270440a940cd2e12b36c449644af94 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Tue, 8 Aug 2023 23:52:37 +0200 Subject: [PATCH] [DB] forgejo migration v2: create the forgejo_sem_ver table (cherry picked from commit 86b26436af85e0eedb732e115e8be024e1d54ca6) (cherry picked from commit 479cba59aca2b3b73a83e5acc0b754906230f0b2) (cherry picked from commit 4765f9a889ce7324416b51e7d4524b2368459752) (cherry picked from commit af771410bfaa511bbc97cbfeefbb279b3836158d) (cherry picked from commit d1ea9305d8d653d637cbde6d383c095bdc4991f0) (cherry picked from commit f77e1bb7abd6054851b811fc0d71bf0130085353) (cherry picked from commit 0b95f8fe899ce14e19e5aeccd3e53e21b8bf8fc1) (cherry picked from commit 4f8fb2390a415d2f9319c9f23ff653c31efd2409) (cherry picked from commit 8ea0e22ff6e09f1e46d9a10f1325f7c6997c018b) (cherry picked from commit 43ac19ac59044210906c96857194231ca7804c92) (cherry picked from commit 0d2f63df4f9579c62ed21c807c53e689b1c71dbb) (cherry picked from commit d02a8036fda2bfcf8791366198e25735547d6b3f) (cherry picked from commit 1fe4c7db941b892df38be12249d4898248ff016e) (cherry picked from commit d641cdeaf0f77ef12fb5fe5c27c20804757a74ef) (cherry picked from commit 10e8a4f8b864961a700f2c3e6c816489bf4e4ac4) (cherry picked from commit 8097bc40b3f90ed959adc9edd1982e5867856397) (cherry picked from commit ee5cb37d7e9567c129fcf2a606175d425dacace1) --- models/forgejo_migrations/migrate.go | 6 +++++- models/forgejo_migrations/v1_20/v2.go | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 models/forgejo_migrations/v1_20/v2.go diff --git a/models/forgejo_migrations/migrate.go b/models/forgejo_migrations/migrate.go index 88bbef70c7..2abacb0679 100644 --- a/models/forgejo_migrations/migrate.go +++ b/models/forgejo_migrations/migrate.go @@ -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{ + // v1 -> v2 + 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) { diff --git a/models/forgejo_migrations/v1_20/v2.go b/models/forgejo_migrations/v1_20/v2.go new file mode 100644 index 0000000000..39f3b58924 --- /dev/null +++ b/models/forgejo_migrations/v1_20/v2.go @@ -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)) +}