mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-07 22:29:02 +00:00
ac49dbe1a2
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
22 lines
491 B
Go
22 lines
491 B
Go
// Copyright 2020 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package v1_12
|
|
|
|
import (
|
|
"context"
|
|
|
|
"gitea.dev/modelmigration/base"
|
|
)
|
|
|
|
func AddOwnerNameOnRepository(_ context.Context, x base.EngineMigration) error {
|
|
type Repository struct {
|
|
OwnerName string
|
|
}
|
|
if err := x.Sync(new(Repository)); err != nil {
|
|
return err
|
|
}
|
|
_, err := x.Exec("UPDATE repository SET owner_name = (SELECT name FROM `user` WHERE `user`.id = repository.owner_id)")
|
|
return err
|
|
}
|