mirror of https://github.com/go-gitea/gitea
Git with a cup of tea, painless self-hosted git service
Mirror for internal git.with.parts use
https://git.with.parts
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
1.4 KiB
29 lines
1.4 KiB
2 years ago
|
// Copyright 2022 The Gitea Authors. All rights reserved.
|
||
|
// Use of this source code is governed by a MIT-style
|
||
|
// license that can be found in the LICENSE file.
|
||
|
|
||
2 years ago
|
package v1_17 // nolint
|
||
2 years ago
|
|
||
|
import (
|
||
|
packages_model "code.gitea.io/gitea/models/packages"
|
||
|
container_module "code.gitea.io/gitea/modules/packages/container"
|
||
|
|
||
|
"xorm.io/xorm"
|
||
|
"xorm.io/xorm/schemas"
|
||
|
)
|
||
|
|
||
2 years ago
|
func AddContainerRepositoryProperty(x *xorm.Engine) (err error) {
|
||
2 years ago
|
switch x.Dialect().URI().DBType {
|
||
|
case schemas.SQLITE:
|
||
2 years ago
|
_, err = x.Exec("INSERT INTO package_property (ref_type, ref_id, name, value) SELECT ?, p.id, ?, u.lower_name || '/' || p.lower_name FROM package p JOIN `user` u ON p.owner_id = u.id WHERE p.type = ?",
|
||
|
packages_model.PropertyTypePackage, container_module.PropertyRepository, packages_model.TypeContainer)
|
||
|
case schemas.MSSQL:
|
||
|
_, err = x.Exec("INSERT INTO package_property (ref_type, ref_id, name, value) SELECT ?, p.id, ?, u.lower_name + '/' + p.lower_name FROM package p JOIN `user` u ON p.owner_id = u.id WHERE p.type = ?",
|
||
|
packages_model.PropertyTypePackage, container_module.PropertyRepository, packages_model.TypeContainer)
|
||
2 years ago
|
default:
|
||
2 years ago
|
_, err = x.Exec("INSERT INTO package_property (ref_type, ref_id, name, value) SELECT ?, p.id, ?, CONCAT(u.lower_name, '/', p.lower_name) FROM package p JOIN `user` u ON p.owner_id = u.id WHERE p.type = ?",
|
||
|
packages_model.PropertyTypePackage, container_module.PropertyRepository, packages_model.TypeContainer)
|
||
2 years ago
|
}
|
||
2 years ago
|
return err
|
||
2 years ago
|
}
|