[DB] forgejo migration v1: add blocked user migration

(cherry picked from commit 66afddd511d2821f648919925ea365cd085e4e77)
(cherry picked from commit 19da0dee9df87cb946d1c8e25b917f7283d95302)
(cherry picked from commit 0b725af693828bd7705b09433fb25d974fbb820e)
(cherry picked from commit 64d4de2b664a9f406b2927c6e6b465ee2b3a8915)
(cherry picked from commit 05bc9d3b7f8d00a37b41615f9caccca84a98c0ee)
(cherry picked from commit 5958553066d275c767018454fbed9470c2cf473d)
(cherry picked from commit c4f77e26c913eb3293bc702e1c65e2d09757cfe1)
(cherry picked from commit 3034832c6637965bf70c766d9169ca3c28c27cd3)
(cherry picked from commit d48931ec5b677989f8b2ef91752b2e3ef25ff2a2)
(cherry picked from commit b1e0d53c28369666367e2629b4226338a111e0e2)
(cherry picked from commit e3de35fe15c33d87f1a33e193fa7e038c5e3a724)
(cherry picked from commit 3b2712c3d6bd0884166787e8c257305d54247112)
(cherry picked from commit 00c6940851ca270934a95de0ccfff2eadf41096f)
(cherry picked from commit ac56c7a202b934d8d46d2eb578d83e953f3b50f5)
(cherry picked from commit d957fb66de9bb8d04cf184c88b4a3ca2ab7728eb)
(cherry picked from commit 01e9125f1b172c8a78a380c611d2244df104178f)
(cherry picked from commit 71675caecb545cda069d766f16feb6bd6924e9ec)
(cherry picked from commit 0313d02e50ee64729fdd3aa661b481ae5d32c029)
(cherry picked from commit d2952769c1217b984936a1bf6a0d4f072217e122)
(cherry picked from commit 63d080cdcfcaac34aa5a3040e00d33506224c112)
(cherry picked from commit 43ced29b28c2631d0d5ec7320ab7b40d9f8e06c9)
(cherry picked from commit e556074abdc39ec02156de47492a35ae3e278b9f)
(cherry picked from commit 165409d8ff75a06563447d490d66c69984e4a04a)
(cherry picked from commit 0a3f370162dcb6c945095864248b8dc55208120f)
This commit is contained in:
Gusted 2023-08-15 01:06:13 +02:00 committed by Earl Warren
parent 40b99a5f89
commit 76c7df9630
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))
}