package model import ( "time" "gorm.io/gorm" ) const ( StatusUnknown = "unknown" StatusUp = "up" StatusDown = "down" StatusSkipped = "skipped" DeploymentQueued = "queued" DeploymentRunning = "running" DeploymentSuccess = "success" DeploymentFailed = "failed" BuildQueued = "queued" BuildRunning = "running" BuildSuccess = "success" BuildFailed = "failed" OperationDeploy = "deploy" OperationRestart = "restart" OperationRollback = "rollback" ) type Host struct { gorm.Model Name string `gorm:"size:64;uniqueIndex;not null" json:"name"` InstanceID string `gorm:"size:64;uniqueIndex" json:"instance_id"` PrivateIP string `gorm:"size:64;index" json:"private_ip"` Role string `gorm:"size:32;index" json:"role"` Environment string `gorm:"size:32;index" json:"environment"` Description string `gorm:"size:255" json:"description"` TATOnline bool `json:"tat_online"` LastSeenAt *time.Time `json:"last_seen_at"` ServiceInstances []ServiceInstance `json:"service_instances,omitempty"` } type ServiceInstance struct { gorm.Model ServiceName string `gorm:"size:32;index;not null" json:"service_name"` HostID uint `gorm:"index;not null" json:"host_id"` Host Host `json:"host"` Port int `json:"port"` UnitName string `gorm:"size:128" json:"unit_name"` HealthPath string `gorm:"size:128" json:"health_path"` ReadyPath string `gorm:"size:128" json:"ready_path"` CurrentReleaseID string `gorm:"size:128;index" json:"current_release_id"` HealthStatus string `gorm:"size:16;default:unknown" json:"health_status"` ReadyStatus string `gorm:"size:16;default:unknown" json:"ready_status"` LastHealthCheckedAt *time.Time `json:"last_health_checked_at"` } type Release struct { gorm.Model ServiceName string `gorm:"size:32;index;not null" json:"service_name"` ReleaseID string `gorm:"size:128;index;not null" json:"release_id"` GitSHA string `gorm:"size:128" json:"git_sha"` COSKey string `gorm:"size:255" json:"cos_key"` SHA256 string `gorm:"size:128" json:"sha256"` ArtifactURL string `gorm:"size:255" json:"artifact_url"` BuildHost string `gorm:"size:128" json:"build_host"` } type BuildJob struct { gorm.Model ServiceName string `gorm:"size:32;index;not null" json:"service_name"` ReleaseID string `gorm:"size:128;index;not null" json:"release_id"` Branch string `gorm:"size:128" json:"branch"` Status string `gorm:"size:32;index;not null" json:"status"` Operator string `gorm:"size:64" json:"operator"` RepoURL string `gorm:"size:255" json:"repo_url"` RepoPath string `gorm:"size:255" json:"repo_path"` CommitSHA string `gorm:"size:128" json:"commit_sha"` BuildHost string `gorm:"size:128" json:"build_host"` COSKey string `gorm:"size:255" json:"cos_key"` ArtifactURL string `gorm:"size:255" json:"artifact_url"` SHA256 string `gorm:"size:128" json:"sha256"` LogOutput string `gorm:"type:text" json:"log_output"` LogExcerpt string `gorm:"type:text" json:"log_excerpt"` ErrorMessage string `gorm:"type:text" json:"error_message"` StartedAt *time.Time `json:"started_at"` FinishedAt *time.Time `json:"finished_at"` } type Deployment struct { gorm.Model ServiceName string `gorm:"size:32;index;not null" json:"service_name"` ReleaseID string `gorm:"size:128;index" json:"release_id"` Operation string `gorm:"size:32;index;not null" json:"operation"` Status string `gorm:"size:32;index;not null" json:"status"` TriggerSource string `gorm:"size:64" json:"trigger_source"` Operator string `gorm:"size:64" json:"operator"` ErrorMessage string `gorm:"type:text" json:"error_message"` StartedAt *time.Time `json:"started_at"` FinishedAt *time.Time `json:"finished_at"` Targets []DeploymentTarget `json:"targets,omitempty"` } type DeploymentTarget struct { gorm.Model DeploymentID uint `gorm:"index;not null" json:"deployment_id"` Deployment Deployment `json:"deployment,omitempty"` ServiceInstanceID uint `gorm:"index;not null" json:"service_instance_id"` ServiceInstance ServiceInstance `json:"service_instance,omitempty"` HostID uint `gorm:"index;not null" json:"host_id"` Host Host `json:"host,omitempty"` Step string `gorm:"size:64" json:"step"` Status string `gorm:"size:32;index;not null" json:"status"` LogExcerpt string `gorm:"type:text" json:"log_excerpt"` StartedAt *time.Time `json:"started_at"` FinishedAt *time.Time `json:"finished_at"` } type ReleaseRun struct { gorm.Model ReleaseID string `gorm:"size:128;index;not null" json:"release_id"` Status string `gorm:"size:32;index;not null" json:"status"` TriggerSource string `gorm:"size:64" json:"trigger_source"` Operator string `gorm:"size:64" json:"operator"` ErrorMessage string `gorm:"type:text" json:"error_message"` StartedAt *time.Time `json:"started_at"` FinishedAt *time.Time `json:"finished_at"` Steps []ReleaseRunStep `json:"steps,omitempty"` } type ReleaseRunStep struct { gorm.Model ReleaseRunID uint `gorm:"index;not null" json:"release_run_id"` ReleaseRun ReleaseRun `json:"release_run,omitempty"` Sequence int `gorm:"index;not null" json:"sequence"` ServiceName string `gorm:"size:32;index;not null" json:"service_name"` PreviousReleaseID string `gorm:"size:128;index" json:"previous_release_id"` Status string `gorm:"size:32;index;not null" json:"status"` DeploymentID *uint `gorm:"index" json:"deployment_id"` Deployment *Deployment `json:"deployment,omitempty"` ErrorMessage string `gorm:"type:text" json:"error_message"` LogExcerpt string `gorm:"type:text" json:"log_excerpt"` StartedAt *time.Time `json:"started_at"` FinishedAt *time.Time `json:"finished_at"` RollbackStatus string `gorm:"size:32;index" json:"rollback_status"` RollbackDeploymentID *uint `gorm:"index" json:"rollback_deployment_id"` RollbackDeployment *Deployment `json:"rollback_deployment,omitempty"` RollbackErrorMessage string `gorm:"type:text" json:"rollback_error_message"` RollbackLogExcerpt string `gorm:"type:text" json:"rollback_log_excerpt"` RollbackStartedAt *time.Time `json:"rollback_started_at"` RollbackFinishedAt *time.Time `json:"rollback_finished_at"` }