Files
Gitea/modelmigration/v1_12/v120.go
T
2026-08-03 08:13:15 +00:00

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
}