mirror of
https://github.com/go-gitea/gitea.git
synced 2026-04-04 03:35:05 +02:00
fix mssql migrations
This commit is contained in:
parent
4951f0c92f
commit
f635f4652e
@ -7,7 +7,8 @@ import "xorm.io/xorm"
|
||||
|
||||
func AddGroupColumnsToRepositoryTable(x *xorm.Engine) error {
|
||||
type Repository struct {
|
||||
GroupID int64 `xorm:"UNIQUE(s) INDEX DEFAULT NULL"`
|
||||
LowerName string `xorm:"UNIQUE(s) UNIQUE(g) INDEX NOT NULL"`
|
||||
GroupID int64 `xorm:"UNIQUE(g) INDEX DEFAULT 0"`
|
||||
GroupSortOrder int
|
||||
}
|
||||
_, err := x.SyncWithOptions(xorm.SyncOptions{
|
||||
|
||||
@ -156,7 +156,7 @@ type Repository struct {
|
||||
OwnerID int64 `xorm:"UNIQUE(s) index"`
|
||||
OwnerName string
|
||||
Owner *user_model.User `xorm:"-"`
|
||||
LowerName string `xorm:"UNIQUE(s) INDEX NOT NULL"`
|
||||
LowerName string `xorm:"UNIQUE(s) UNIQUE(g) INDEX NOT NULL"`
|
||||
Name string `xorm:"INDEX NOT NULL"`
|
||||
Description string `xorm:"TEXT"`
|
||||
Website string `xorm:"VARCHAR(2048)"`
|
||||
@ -220,7 +220,7 @@ type Repository struct {
|
||||
UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"`
|
||||
ArchivedUnix timeutil.TimeStamp `xorm:"DEFAULT 0"`
|
||||
|
||||
GroupID int64 `xorm:"UNIQUE(s) INDEX DEFAULT NULL"`
|
||||
GroupID int64 `xorm:"UNIQUE(g) INDEX DEFAULT 0"`
|
||||
GroupSortOrder int `xorm:"INDEX"`
|
||||
}
|
||||
|
||||
@ -812,6 +812,11 @@ func (err ErrRepoNotExist) Unwrap() error {
|
||||
// GetRepositoryByOwnerAndName returns the repository by given owner name and repo name
|
||||
func GetRepositoryByOwnerAndName(ctx context.Context, ownerName, repoName string, groupID int64) (*Repository, error) {
|
||||
var repo Repository
|
||||
var gid any = groupID
|
||||
if groupID == 0 {
|
||||
gid = nil
|
||||
}
|
||||
_ = gid
|
||||
has, err := db.GetEngine(ctx).Table("repository").Select("repository.*").
|
||||
Join("INNER", "`user`", "`user`.id = repository.owner_id").
|
||||
Where("repository.lower_name = ?", strings.ToLower(repoName)).
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user