[DB] forgejo migration v1: add blocked user migration

(cherry picked from commit 66afddd511)
(cherry picked from commit 19da0dee9d)
(cherry picked from commit 0b725af693)
(cherry picked from commit 64d4de2b66)
(cherry picked from commit 05bc9d3b7f)
(cherry picked from commit 5958553066)
(cherry picked from commit c4f77e26c9)
(cherry picked from commit 3034832c66)
(cherry picked from commit d48931ec5b)
(cherry picked from commit b1e0d53c28)
(cherry picked from commit e3de35fe15)
(cherry picked from commit 3b2712c3d6)
(cherry picked from commit 00c6940851)
(cherry picked from commit ac56c7a202)
(cherry picked from commit d957fb66de)
(cherry picked from commit 01e9125f1b)
(cherry picked from commit 71675caecb)
(cherry picked from commit 0313d02e50)
(cherry picked from commit d2952769c1)
(cherry picked from commit 63d080cdcf)
(cherry picked from commit 43ced29b28)
This commit is contained in:
Gusted 2023-08-15 01:06:13 +02:00 committed by Earl Warren
parent b5001edeea
commit e556074abd
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
2 changed files with 23 additions and 0 deletions

View file

@ -36,6 +36,8 @@ 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{
// v0 -> v1
NewMigration("Add Forgejo Blocked Users table", forgejo_v1_20.AddForgejoBlockedUser),
// v1 -> v2 // v1 -> v2
NewMigration("create the forgejo_sem_ver table", forgejo_v1_20.CreateSemVerTable), NewMigration("create the forgejo_sem_ver table", forgejo_v1_20.CreateSemVerTable),
} }

View file

@ -0,0 +1,21 @@
// Copyright 2023 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgejo_v1_20 //nolint:revive
import (
"code.gitea.io/gitea/modules/timeutil"
"xorm.io/xorm"
)
func AddForgejoBlockedUser(x *xorm.Engine) error {
type ForgejoBlockedUser struct {
ID int64 `xorm:"pk autoincr"`
BlockID int64 `xorm:"index"`
UserID int64 `xorm:"index"`
CreatedUnix timeutil.TimeStamp `xorm:"created"`
}
return x.Sync(new(ForgejoBlockedUser))
}