archie-state-store import copies the State Store task database, the PocketBase event store and the Gateway conversation store, all named from db_path, into Postgres in one transaction. The bead asked for an archied command; offline maintenance of a store belongs to the binary that owns it, so it sits beside backup/restore/validate/rollback instead. It refuses rather than guesses: while the state-store or gateway ownership claim is held, when a domain it imports already holds rows (an allowlist of that domain's tables, checked after Migrate), on a completed prior import, on FK orphans, alias case collisions, duplicate bindings, events whose (at, id) order microsecond storage would change, schema gaps, and any value the target column cannot hold, naming table, row, value and rule. Historical ids are kept and every identity sequence is set from AUTOINCREMENT's high-water mark. After loading it compares key sets, event order, resource blobs and binding secrets byte for byte and the next id of every sequence, checks the source files were not written while read, and only then writes an import_completion row (migration 0005) in the same transaction. postgres.ImportComplete and legacyimport.HasLegacyData are the two halves of the boot gate: legacy data without a completed import must not serve.
265 lines
5.1 KiB
Go
265 lines
5.1 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.31.1
|
|
|
|
package postgresdb
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
type ApplyStatus struct {
|
|
Process string
|
|
Kind string
|
|
AppliedVersion int64
|
|
Error string
|
|
ReportedAt time.Time
|
|
}
|
|
|
|
type Binding struct {
|
|
ID string
|
|
Name string
|
|
Source string
|
|
Mapping string
|
|
Workflow string
|
|
Owner string
|
|
Repo string
|
|
Version int64
|
|
Status string
|
|
Secret string
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
}
|
|
|
|
type BindingDispatch struct {
|
|
Binding string
|
|
BindingVersion int64
|
|
Capture string
|
|
TaskID int64
|
|
DispatchedAt time.Time
|
|
}
|
|
|
|
type Capture struct {
|
|
ID string
|
|
Source string
|
|
RemoteAddr string
|
|
ContentType string
|
|
Headers string
|
|
Body string
|
|
Authenticated bool
|
|
ReceivedAt time.Time
|
|
}
|
|
|
|
type ChannelStatus struct {
|
|
ID string
|
|
Name string
|
|
State string
|
|
Detail string
|
|
Configured bool
|
|
ReloadSupported bool
|
|
ObservedAt time.Time
|
|
}
|
|
|
|
type ConfigSnapshot struct {
|
|
ID int64
|
|
Schema string
|
|
Document string
|
|
PublishedAt time.Time
|
|
}
|
|
|
|
type Event struct {
|
|
ID int64
|
|
At time.Time
|
|
Kind string
|
|
TaskID int64
|
|
Repo string
|
|
Issue int64
|
|
Workflow string
|
|
Stage string
|
|
Attempt int64
|
|
ActorID string
|
|
ActorKind string
|
|
PrincipalID string
|
|
Detail string
|
|
Data string
|
|
}
|
|
|
|
type Identity struct {
|
|
ID string
|
|
Kind string
|
|
DisplayName string
|
|
Lifecycle string
|
|
Version int64
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
}
|
|
|
|
type IdentityAlias struct {
|
|
Alias string
|
|
IdentityID string
|
|
}
|
|
|
|
type IdentityEvent struct {
|
|
ID int64
|
|
IdentityID string
|
|
EventType string
|
|
FromLifecycle string
|
|
ToLifecycle string
|
|
DisplayName string
|
|
ActorID string
|
|
Source string
|
|
RequestID string
|
|
At time.Time
|
|
}
|
|
|
|
type IdentitySubject struct {
|
|
Issuer string
|
|
Subject string
|
|
IdentityID string
|
|
BoundAt time.Time
|
|
}
|
|
|
|
type ImportCompletion struct {
|
|
ID int64
|
|
CompletedAt time.Time
|
|
Sources string
|
|
Report string
|
|
}
|
|
|
|
type Mapping struct {
|
|
ID string
|
|
Name string
|
|
SourceHint string
|
|
Fields string
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
}
|
|
|
|
type Message struct {
|
|
ID int64
|
|
MessageID string
|
|
SessionID string
|
|
SourceID string
|
|
Sender string
|
|
SenderID string
|
|
Role string
|
|
Text string
|
|
Ts int64
|
|
Search interface{}
|
|
}
|
|
|
|
type PlaybookDispatch struct {
|
|
PlaybookID string
|
|
PlaybookVersion string
|
|
EventID string
|
|
ActionID string
|
|
DispatchedAt time.Time
|
|
}
|
|
|
|
type Resource struct {
|
|
Kind string
|
|
Value []byte
|
|
Version int64
|
|
UpdatedAt time.Time
|
|
}
|
|
|
|
type ResourceHistory struct {
|
|
ID int64
|
|
Kind string
|
|
Value []byte
|
|
Version int64
|
|
Actor string
|
|
Source string
|
|
RequestID string
|
|
ExpectedVersion int64
|
|
CurrentVersion int64
|
|
At time.Time
|
|
}
|
|
|
|
type Session struct {
|
|
SessionID string
|
|
Platform string
|
|
BotUser string
|
|
ChannelID string
|
|
ThreadID string
|
|
Title string
|
|
ParentSessionID string
|
|
BranchName string
|
|
CreatedAt int64
|
|
LastActiveAt int64
|
|
}
|
|
|
|
type Task struct {
|
|
ID int64
|
|
Owner string
|
|
Repo string
|
|
IssueNumber int64
|
|
Title string
|
|
Body string
|
|
Labels string
|
|
Status string
|
|
Workflow string
|
|
Stage string
|
|
Branch string
|
|
Plan string
|
|
Notes string
|
|
PrNumber int64
|
|
TokensUsed int64
|
|
Iterations int64
|
|
Attempt int64
|
|
ParkReason string
|
|
WatchCommentID int64
|
|
ParkClass string
|
|
RemediationRounds int64
|
|
RetryCount int64
|
|
Source string
|
|
Identity string
|
|
BindingID string
|
|
BindingVersion int64
|
|
ReviewPayload string
|
|
WorkflowDefinitionVersion int64
|
|
WorkflowDefinitionDigest string
|
|
WorkflowDefinitionYaml string
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
ReviewCursor int64
|
|
}
|
|
|
|
type ToolCall struct {
|
|
ID string
|
|
TaskID int64
|
|
Attempt int64
|
|
Tool string
|
|
Args string
|
|
Result string
|
|
Error string
|
|
DurationMs int64
|
|
CalledAt time.Time
|
|
}
|
|
|
|
type Transition struct {
|
|
ID int64
|
|
TaskID int64
|
|
At time.Time
|
|
FromStatus string
|
|
ToStatus string
|
|
Detail string
|
|
}
|
|
|
|
type Turn struct {
|
|
TurnID string
|
|
SessionID string
|
|
SourceID string
|
|
Status string
|
|
Attempt int64
|
|
OwnerID string
|
|
InputMessageID string
|
|
AssistantMessageID string
|
|
PartialText string
|
|
ResponseText string
|
|
ToolCalls string
|
|
Error string
|
|
CreatedAt int64
|
|
UpdatedAt int64
|
|
}
|