Некоторые проверки не удались
CI / test (push) Successful in 2m5s
Docker / Build and publish worker image (push) Failing after 31s
39 строки
1.6 KiB
Go
39 строки
1.6 KiB
Go
package models
|
|
|
|
import (
|
|
"gorm.io/datatypes"
|
|
|
|
"rocketgit.ru/rsmon/worker/app/models/concerns"
|
|
)
|
|
|
|
// Repo is a source repository shared by one or more account-scoped sites.
|
|
// Repositories themselves are global rstuff mirrors; SiteRepo supplies the
|
|
// account boundary through its Site.
|
|
type Repo struct {
|
|
concerns.Model
|
|
ExtID *string `gorm:"size:64" json:"ext_id,omitempty"`
|
|
GitlabID *int64 `json:"gitlab_id,omitempty"`
|
|
Name string `gorm:"size:120;not null" json:"name"`
|
|
Namespace *string `gorm:"size:120" json:"namespace,omitempty"`
|
|
Path *string `gorm:"size:255" json:"path,omitempty"`
|
|
Description *string `gorm:"type:text" json:"description,omitempty"`
|
|
IsActive bool `gorm:"not null;default:true" json:"is_active"`
|
|
Meta datatypes.JSON `gorm:"type:jsonb;not null;default:'{}'::jsonb" json:"meta"`
|
|
concerns.Timestamped
|
|
}
|
|
|
|
// TableName returns the repository table name.
|
|
func (Repo) TableName() string { return "repos" }
|
|
|
|
// SiteRepo is the explicit site/repository join. Role is intentionally data,
|
|
// rather than an enum, to preserve the rstuff contract as it evolves.
|
|
type SiteRepo struct {
|
|
SiteID int64 `gorm:"type:bigint REFERENCES sites(id) ON DELETE CASCADE;primaryKey" json:"site_id"`
|
|
RepoID int64 `gorm:"type:bigint REFERENCES repos(id) ON DELETE CASCADE;primaryKey" json:"repo_id"`
|
|
Role string `gorm:"size:32;not null;default:'primary'" json:"role"`
|
|
concerns.Timestamped
|
|
}
|
|
|
|
// TableName returns the repository assignment table name.
|
|
func (SiteRepo) TableName() string { return "site_repos" }
|