mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-07-29 04:01:59 +08:00

* fix: move migrations to bun * fix: use anonymous structs and move modes to types package * fix: minor changes after tests * fix: remove bun relations and add foreign keys * fix: minor changes * Update pkg/types/agent.go Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * fix: address minor comments * fix: use bun create index * fix: remove extra comma --------- Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
50 lines
2.1 KiB
Go
50 lines
2.1 KiB
Go
package types
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/uptrace/bun"
|
|
)
|
|
|
|
type Agent struct {
|
|
bun.BaseModel `bun:"table:agents"`
|
|
AgentID string `bun:"agent_id,pk,type:text"`
|
|
StartedAt time.Time `bun:"started_at,type:datetime,notnull"`
|
|
TerminatedAt time.Time `bun:"terminated_at,type:datetime"`
|
|
CurrentStatus string `bun:"current_status,type:text,notnull"`
|
|
EffectiveConfig string `bun:"effective_config,type:text,notnull"`
|
|
}
|
|
|
|
type AgentConfigVersion struct {
|
|
bun.BaseModel `bun:"table:agent_config_versions"`
|
|
|
|
ID string `bun:"id,pk,type:text"`
|
|
CreatedBy string `bun:"created_by,type:text"`
|
|
CreatedAt time.Time `bun:"created_at,default:CURRENT_TIMESTAMP"`
|
|
UpdatedBy string `bun:"updated_by,type:text"`
|
|
UpdatedAt time.Time `bun:"updated_at,default:CURRENT_TIMESTAMP"`
|
|
Version int `bun:"version,default:1,unique:element_version_idx"`
|
|
Active int `bun:"active"`
|
|
IsValid int `bun:"is_valid"`
|
|
Disabled int `bun:"disabled"`
|
|
ElementType string `bun:"element_type,notnull,type:varchar(120),unique:element_version_idx"`
|
|
DeployStatus string `bun:"deploy_status,notnull,type:varchar(80),default:'DIRTY'"`
|
|
DeploySequence int `bun:"deploy_sequence"`
|
|
DeployResult string `bun:"deploy_result,type:text"`
|
|
LastHash string `bun:"last_hash,type:text"`
|
|
LastConfig string `bun:"last_config,type:text"`
|
|
}
|
|
|
|
type AgentConfigElement struct {
|
|
bun.BaseModel `bun:"table:agent_config_elements"`
|
|
|
|
ID string `bun:"id,pk,type:text"`
|
|
CreatedBy string `bun:"created_by,type:text"`
|
|
CreatedAt time.Time `bun:"created_at,default:CURRENT_TIMESTAMP"`
|
|
UpdatedBy string `bun:"updated_by,type:text"`
|
|
UpdatedAt time.Time `bun:"updated_at,default:CURRENT_TIMESTAMP"`
|
|
ElementID string `bun:"element_id,type:text,notnull,unique:agent_config_elements_u1"`
|
|
ElementType string `bun:"element_type,type:varchar(120),notnull,unique:agent_config_elements_u1"`
|
|
VersionID string `bun:"version_id,type:text,notnull,unique:agent_config_elements_u1"`
|
|
}
|