mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-04-20 03:11:35 +02:00
migrations: add FederationHost; add FederatedUser
This commit is contained in:
parent
7d4e2f1ce2
commit
afbd4d8d77
2 changed files with 31 additions and 0 deletions
|
@ -94,6 +94,8 @@ var migrations = []*Migration{
|
|||
NewMigration("Add `created_unix` column to `user_redirect` table", AddCreatedUnixToRedirect),
|
||||
// v27 -> v28
|
||||
NewMigration("Add pronoun privacy settings to user", AddHidePronounsOptionToUser),
|
||||
// v28 -> v29
|
||||
NewMigration("Add public key information to `FederatedUser` and `FederationHost`", AddPublicKeyInformationForFederation),
|
||||
}
|
||||
|
||||
// GetCurrentDBVersion returns the current Forgejo database version.
|
||||
|
|
29
models/forgejo_migrations/v29.go
Normal file
29
models/forgejo_migrations/v29.go
Normal file
|
@ -0,0 +1,29 @@
|
|||
// Copyright 2025 The Forgejo Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package forgejo_migrations //nolint:revive
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func AddPublicKeyInformationForFederation(x *xorm.Engine) error {
|
||||
type FederationHost struct {
|
||||
KeyID sql.NullString `xorm:"key_id UNIQUE"`
|
||||
PublicKey sql.Null[sql.RawBytes] `xorm:"BLOB"`
|
||||
}
|
||||
|
||||
err := x.Sync(&FederationHost{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
type FederatedUser struct {
|
||||
KeyID sql.NullString `xorm:"key_id UNIQUE"`
|
||||
PublicKey sql.Null[sql.RawBytes] `xorm:"BLOB"`
|
||||
}
|
||||
|
||||
return x.Sync(&FederatedUser{})
|
||||
}
|
Loading…
Add table
Reference in a new issue