mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-22 09:54:24 +01:00
[DB] forgejo migration v1: add blocked user migration
(cherry picked from commit 66afddd511
)
This commit is contained in:
parent
4765f9a889
commit
19da0dee9d
|
@ -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),
|
||||||
}
|
}
|
||||||
|
|
21
models/forgejo_migrations/v1_20/v1.go
Normal file
21
models/forgejo_migrations/v1_20/v1.go
Normal 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))
|
||||||
|
}
|
Loading…
Reference in a new issue