package models import ( "encoding/json" "time" ) type Repository struct { ID uint `gorm:"primaryKey"` Name string `gorm:"not null;index:idx_repositories_owner_name,unique"` Owner string `gorm:"not null;index:idx_repositories_owner_name,unique"` CreatedAt time.Time UpdatedAt time.Time } func (Repository) TableName() string { return "repositories" } type Commit struct { ID uint `gorm:"primaryKey"` RepositoryID uint `gorm:"not null;index:idx_commits_repository_sha,unique"` SHA string `gorm:"not null;index:idx_commits_repository_sha,unique"` Author *string Message *string Branch *string CommittedAt *time.Time CreatedAt time.Time Repository Repository `gorm:"foreignKey:RepositoryID"` } func (Commit) TableName() string { return "commits" } type Build struct { ID uint `gorm:"primaryKey"` RepositoryID uint `gorm:"not null;index"` CommitID uint `gorm:"not null;index"` Builder *string BuildFlags *string Tags json.RawMessage `gorm:"type:jsonb;default:'{}'"` CreatedAt time.Time Repository Repository `gorm:"foreignKey:RepositoryID"` Commit Commit `gorm:"foreignKey:CommitID"` } func (Build) TableName() string { return "builds" } type Artifact struct { ID uint `gorm:"primaryKey"` RepositoryID uint `gorm:"not null;index"` CommitID uint `gorm:"not null;index"` BuildID *uint `gorm:"index"` RunID *uint `gorm:"index"` CrashSignatureID *uint `gorm:"index"` Type string `gorm:"not null;index"` BlobKey string `gorm:"not null"` BlobSize int64 `gorm:"not null"` CrashMessage *string StackTrace *string Tags json.RawMessage `gorm:"type:jsonb;default:'{}'"` Metadata json.RawMessage `gorm:"type:jsonb;default:'{}'"` CreatedAt time.Time Repository Repository `gorm:"foreignKey:RepositoryID"` Commit Commit `gorm:"foreignKey:CommitID"` Build *Build `gorm:"foreignKey:BuildID"` Run *Run `gorm:"foreignKey:RunID"` Signature *CrashSignature `gorm:"foreignKey:CrashSignatureID"` } func (Artifact) TableName() string { return "artifacts" } type Target struct { ID uint `gorm:"primaryKey"` RepositoryID uint `gorm:"not null;index:idx_targets_repo_name,unique"` Name string `gorm:"not null;index:idx_targets_repo_name,unique"` Type string `gorm:"not null"` Tags json.RawMessage `gorm:"type:jsonb;default:'{}'"` Metadata json.RawMessage `gorm:"type:jsonb;default:'{}'"` CreatedAt time.Time UpdatedAt time.Time Repository Repository `gorm:"foreignKey:RepositoryID"` } func (Target) TableName() string { return "targets" } type Run struct { ID uint `gorm:"primaryKey"` TargetID uint `gorm:"not null;index"` CommitID uint `gorm:"not null;index"` Status string `gorm:"not null;default:running;index"` StartedAt time.Time `gorm:"not null;autoCreateTime"` FinishedAt *time.Time Tags json.RawMessage `gorm:"type:jsonb;default:'{}'"` Metadata json.RawMessage `gorm:"type:jsonb;default:'{}'"` CreatedAt time.Time Target Target `gorm:"foreignKey:TargetID"` Commit Commit `gorm:"foreignKey:CommitID"` } func (Run) TableName() string { return "runs" } type CorpusEntry struct { ID uint `gorm:"primaryKey"` TargetID uint `gorm:"not null;index"` RunID *uint `gorm:"index"` BlobKey string `gorm:"not null"` BlobSize int64 `gorm:"not null"` Fingerprint *string `gorm:"index"` CreatedAt time.Time Target Target `gorm:"foreignKey:TargetID"` Run *Run `gorm:"foreignKey:RunID"` } func (CorpusEntry) TableName() string { return "corpus_entries" } type CrashSignature struct { ID uint `gorm:"primaryKey"` RepositoryID uint `gorm:"not null;index:idx_signatures_repo_fingerprint,unique"` Fingerprint string `gorm:"not null;index:idx_signatures_repo_fingerprint,unique"` SampleTrace *string FirstSeenAt time.Time `gorm:"not null;autoCreateTime"` LastSeenAt time.Time `gorm:"not null;autoCreateTime"` OccurrenceCount uint `gorm:"not null;default:1"` Repository Repository `gorm:"foreignKey:RepositoryID"` } func (CrashSignature) TableName() string { return "crash_signatures" } type CrashGroup struct { ID uint `gorm:"primaryKey"` RepositoryID uint `gorm:"not null;index"` CrashSignatureID uint `gorm:"not null;index"` Title string `gorm:"not null"` Status string `gorm:"not null;default:open;index"` ForgejoIssueID *int FirstSeenAt time.Time `gorm:"not null;autoCreateTime"` LastSeenAt time.Time `gorm:"not null;autoCreateTime"` CreatedAt time.Time UpdatedAt time.Time Repository Repository `gorm:"foreignKey:RepositoryID"` CrashSignature CrashSignature `gorm:"foreignKey:CrashSignatureID"` } func (CrashGroup) TableName() string { return "crash_groups" }