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