| 1 | package equipo |
| 2 | |
| 3 | // These private models describe columns and named indexes for migration checks. |
| 4 | // SQL owns the unnamed checks, foreign keys and compound unique constraints; |
| 5 | // TestExecutionSchemaParity compares those against the standalone core. |
| 6 | |
| 7 | type executionActions struct { |
| 8 | ID int64 `gorm:"column:id;type:integer;primaryKey;autoIncrement:false"` |
| 9 | JobID int64 `gorm:"column:job_id;type:integer;not null"` |
| 10 | StepID int64 `gorm:"column:step_id;type:integer;not null"` |
| 11 | AttemptID int64 `gorm:"column:attempt_id;type:integer;not null"` |
| 12 | Fence int64 `gorm:"column:fence;type:integer;not null"` |
| 13 | Key string `gorm:"column:key;type:text;not null"` |
| 14 | Operation string `gorm:"column:operation;type:text;not null"` |
| 15 | Class string `gorm:"column:class;type:text;not null"` |
| 16 | PayloadHash string `gorm:"column:payload_hash;type:text;not null"` |
| 17 | Payload []byte `gorm:"column:payload;type:blob;not null"` |
| 18 | State string `gorm:"column:state;type:text;not null;index:actions_state,priority:1"` |
| 19 | ReservationID int64 `gorm:"column:reservation_id;type:integer;not null"` |
| 20 | GrantRef string `gorm:"column:grant_ref;type:text;not null"` |
| 21 | GrantVersion int64 `gorm:"column:grant_version;type:integer;not null"` |
| 22 | GrantEpoch int64 `gorm:"column:grant_epoch;type:integer;not null"` |
| 23 | AdmittedAt string `gorm:"column:admitted_at;type:text;not null"` |
| 24 | AdmissionEnds string `gorm:"column:admission_ends;type:text;not null"` |
| 25 | Receipt string `gorm:"column:receipt;type:text;not null"` |
| 26 | LastError string `gorm:"column:last_error;type:text;not null"` |
| 27 | CreatedAt string `gorm:"column:created_at;type:text;not null"` |
| 28 | UpdatedAt string `gorm:"column:updated_at;type:text;not null"` |
| 29 | AdmittedIncarnation int64 `gorm:"column:admitted_incarnation;type:integer;not null;default:0"` |
| 30 | } |
| 31 | |
| 32 | func (executionActions) TableName() string { return "actions" } |
| 33 | |
| 34 | type executionArtifacts struct { |
| 35 | ID int64 `gorm:"column:id;type:integer;primaryKey;autoIncrement:false"` |
| 36 | JobID int64 `gorm:"column:job_id;type:integer;not null;index:artifacts_job,priority:1"` |
| 37 | StepID int64 `gorm:"column:step_id;type:integer;not null"` |
| 38 | AttemptID int64 `gorm:"column:attempt_id;type:integer;not null"` |
| 39 | Fence int64 `gorm:"column:fence;type:integer;not null"` |
| 40 | Role string `gorm:"column:role;type:text;not null;index:artifacts_job,priority:2"` |
| 41 | Hash string `gorm:"column:hash;type:text;not null"` |
| 42 | MediaType string `gorm:"column:media_type;type:text;not null"` |
| 43 | Size int64 `gorm:"column:size;type:integer;not null"` |
| 44 | Provenance string `gorm:"column:provenance;type:text;not null"` |
| 45 | Payload []byte `gorm:"column:payload;type:blob;not null"` |
| 46 | CreatedAt string `gorm:"column:created_at;type:text;not null"` |
| 47 | } |
| 48 | |
| 49 | func (executionArtifacts) TableName() string { return "artifacts" } |
| 50 | |
| 51 | type executionAttempts struct { |
| 52 | ID int64 `gorm:"column:id;type:integer;primaryKey;autoIncrement:false"` |
| 53 | JobID int64 `gorm:"column:job_id;type:integer;not null;index:attempts_job,priority:1"` |
| 54 | StepID int64 `gorm:"column:step_id;type:integer;not null;uniqueIndex:attempts_one_live,priority:1,where:containment = 'pending'"` |
| 55 | Number int64 `gorm:"column:number;type:integer;not null"` |
| 56 | Runner string `gorm:"column:runner;type:text;not null"` |
| 57 | Workspace string `gorm:"column:workspace;type:text;not null"` |
| 58 | Fence int64 `gorm:"column:fence;type:integer;not null"` |
| 59 | LeaseDeadline string `gorm:"column:lease_deadline;type:text;not null"` |
| 60 | State string `gorm:"column:state;type:text;not null"` |
| 61 | Containment string `gorm:"column:containment;type:text;not null;index:attempts_job,priority:2"` |
| 62 | StopRequested string `gorm:"column:stop_requested;type:text;not null"` |
| 63 | StopAcked string `gorm:"column:stop_acked;type:text;not null"` |
| 64 | Provider string `gorm:"column:provider;type:text;not null"` |
| 65 | Model string `gorm:"column:model;type:text;not null"` |
| 66 | Effort string `gorm:"column:effort;type:text;not null"` |
| 67 | Outcome string `gorm:"column:outcome;type:text;not null"` |
| 68 | CreatedAt string `gorm:"column:created_at;type:text;not null"` |
| 69 | UpdatedAt string `gorm:"column:updated_at;type:text;not null"` |
| 70 | } |
| 71 | |
| 72 | func (executionAttempts) TableName() string { return "attempts" } |
| 73 | |
| 74 | type executionEvents struct { |
| 75 | JobID int64 `gorm:"column:job_id;type:integer;primaryKey;autoIncrement:false;not null"` |
| 76 | Seq int64 `gorm:"column:seq;type:integer;primaryKey;autoIncrement:false;not null"` |
| 77 | Type string `gorm:"column:type;type:text;not null"` |
| 78 | Actor string `gorm:"column:actor;type:text;not null"` |
| 79 | Payload []byte `gorm:"column:payload;type:blob;not null"` |
| 80 | SourceAt string `gorm:"column:source_at;type:text;not null"` |
| 81 | } |
| 82 | |
| 83 | func (executionEvents) TableName() string { return "events" } |
| 84 | |
| 85 | type executionJobs struct { |
| 86 | RequestKey string `gorm:"type:text;not null;default:'';uniqueIndex:jobs_request,priority:3,where:request_key <> ''"` |
| 87 | RequestHash string `gorm:"type:text;not null;default:''"` |
| 88 | GrantStale int64 `gorm:"type:integer;not null;default:0"` |
| 89 | ID int64 `gorm:"column:id;type:integer;primaryKey;autoIncrement:false"` |
| 90 | Account string `gorm:"column:account;type:text;not null;index:jobs_account,priority:1;uniqueIndex:jobs_request,priority:1,where:request_key <> ''"` |
| 91 | Parent int64 `gorm:"column:parent;type:integer;not null"` |
| 92 | Depth int64 `gorm:"column:depth;type:integer;not null"` |
| 93 | Requester string `gorm:"column:requester;type:text;not null;uniqueIndex:jobs_request,priority:2,where:request_key <> ''"` |
| 94 | Target string `gorm:"column:target;type:text;not null"` |
| 95 | Evidence string `gorm:"column:evidence;type:text;not null"` |
| 96 | PolicyVersion int64 `gorm:"column:policy_version;type:integer;not null"` |
| 97 | Policy string `gorm:"column:policy;type:text;not null"` |
| 98 | GrantRef string `gorm:"column:grant_ref;type:text;not null"` |
| 99 | GrantVersion int64 `gorm:"column:grant_version;type:integer;not null"` |
| 100 | GrantEpoch int64 `gorm:"column:grant_epoch;type:integer;not null"` |
| 101 | GrantObservedAt string `gorm:"column:grant_observed_at;type:text;not null"` |
| 102 | State string `gorm:"column:state;type:text;not null;index:jobs_account,priority:2"` |
| 103 | Wait string `gorm:"column:wait;type:text;not null"` |
| 104 | Revision int64 `gorm:"column:revision;type:integer;not null"` |
| 105 | Outcome string `gorm:"column:outcome;type:text;not null"` |
| 106 | CreatedAt string `gorm:"column:created_at;type:text;not null"` |
| 107 | UpdatedAt string `gorm:"column:updated_at;type:text;not null"` |
| 108 | ProjectID int64 `gorm:"column:project_id;type:integer;not null;default:0"` |
| 109 | } |
| 110 | |
| 111 | func (executionJobs) TableName() string { return "jobs" } |
| 112 | |
| 113 | type executionPeriodBudgets struct { |
| 114 | ContentHash string `gorm:"type:text;not null;default:''"` |
| 115 | Account string `gorm:"column:account;type:text;primaryKey;autoIncrement:false"` |
| 116 | Revision int64 `gorm:"column:revision;type:integer;not null"` |
| 117 | Config string `gorm:"column:config;type:text;not null"` |
| 118 | } |
| 119 | |
| 120 | func (executionPeriodBudgets) TableName() string { return "period_budgets" } |
| 121 | |
| 122 | type executionReservations struct { |
| 123 | ProjectID int64 `gorm:"type:integer;not null;default:0;index:reservations_period_project,priority:2"` |
| 124 | Period string `gorm:"type:text;not null;default:'';index:reservations_period_account,priority:3;index:reservations_period_project,priority:4"` |
| 125 | CostUnavailable int64 `gorm:"type:integer;not null;default:0"` |
| 126 | SCached int64 `gorm:"type:integer;not null;default:0"` |
| 127 | ID int64 `gorm:"column:id;type:integer;primaryKey;autoIncrement:false"` |
| 128 | Account string `gorm:"column:account;type:text;not null;index:reservations_account,priority:1;index:reservations_period_account,priority:1;index:reservations_period_project,priority:1"` |
| 129 | JobID int64 `gorm:"column:job_id;type:integer;not null;index:reservations_job,priority:1"` |
| 130 | StepID int64 `gorm:"column:step_id;type:integer;not null"` |
| 131 | AttemptID int64 `gorm:"column:attempt_id;type:integer;not null"` |
| 132 | ActionID int64 `gorm:"column:action_id;type:integer;not null"` |
| 133 | RCalls int64 `gorm:"column:r_calls;type:integer;not null"` |
| 134 | RInput int64 `gorm:"column:r_input;type:integer;not null"` |
| 135 | ROutput int64 `gorm:"column:r_output;type:integer;not null"` |
| 136 | RCost int64 `gorm:"column:r_cost;type:integer;not null"` |
| 137 | SCalls int64 `gorm:"column:s_calls;type:integer;not null"` |
| 138 | SInput int64 `gorm:"column:s_input;type:integer;not null"` |
| 139 | SOutput int64 `gorm:"column:s_output;type:integer;not null"` |
| 140 | SCost int64 `gorm:"column:s_cost;type:integer;not null"` |
| 141 | State string `gorm:"column:state;type:text;not null;index:reservations_job,priority:2;index:reservations_account,priority:2;index:reservations_period_account,priority:2;index:reservations_period_project,priority:3"` |
| 142 | ReceiptID string `gorm:"column:receipt_id;type:text;not null"` |
| 143 | SettledBy string `gorm:"column:settled_by;type:text;not null"` |
| 144 | CreatedAt string `gorm:"column:created_at;type:text;not null"` |
| 145 | SettledAt string `gorm:"column:settled_at;type:text;not null"` |
| 146 | } |
| 147 | |
| 148 | func (executionReservations) TableName() string { return "reservations" } |
| 149 | |
| 150 | type executionService struct { |
| 151 | ReleaseRequired int64 `gorm:"type:integer;not null;default:0"` |
| 152 | RecoveryRevision int64 `gorm:"type:integer;not null;default:0"` |
| 153 | ReconciledRevision int64 `gorm:"type:integer;not null;default:-1"` |
| 154 | ClockHighWater string `gorm:"type:text;not null;default:''"` |
| 155 | ID int64 `gorm:"column:id;type:integer;primaryKey;autoIncrement:false"` |
| 156 | SchemaVersion int64 `gorm:"column:schema_version;type:integer;not null"` |
| 157 | Incarnation int64 `gorm:"column:incarnation;type:integer;not null"` |
| 158 | Revision int64 `gorm:"column:revision;type:integer;not null;default:0"` |
| 159 | RestoreUncertain int64 `gorm:"column:restore_uncertain;type:integer;not null;default:0"` |
| 160 | AdmissionPaused int64 `gorm:"column:admission_paused;type:integer;not null"` |
| 161 | Quarantine int64 `gorm:"column:quarantine;type:integer;not null"` |
| 162 | QuarantineWhy string `gorm:"column:quarantine_why;type:text;not null"` |
| 163 | } |
| 164 | |
| 165 | func (executionService) TableName() string { return "service" } |
| 166 | |
| 167 | type executionSteps struct { |
| 168 | ID int64 `gorm:"column:id;type:integer;primaryKey;autoIncrement:false"` |
| 169 | JobID int64 `gorm:"column:job_id;type:integer;not null"` |
| 170 | Key string `gorm:"column:key;type:text;not null"` |
| 171 | Capability string `gorm:"column:capability;type:text;not null"` |
| 172 | Version int64 `gorm:"column:version;type:integer;not null"` |
| 173 | DependsOn string `gorm:"column:depends_on;type:text;not null"` |
| 174 | State string `gorm:"column:state;type:text;not null"` |
| 175 | Fence int64 `gorm:"column:fence;type:integer;not null"` |
| 176 | Holder int64 `gorm:"column:holder;type:integer;not null"` |
| 177 | Attempts int64 `gorm:"column:attempts;type:integer;not null"` |
| 178 | } |
| 179 | |
| 180 | func (executionSteps) TableName() string { return "steps" } |
| 181 | |
| 182 | type executionTimeReservations struct { |
| 183 | ElapsedUnknown int64 `gorm:"type:integer;not null;default:0"` |
| 184 | AttemptID int64 `gorm:"column:attempt_id;type:integer;primaryKey;autoIncrement:false"` |
| 185 | Account string `gorm:"column:account;type:text;not null;index:time_reservations_account,priority:1;index:time_period_account,priority:1;index:time_period_project,priority:1"` |
| 186 | ProjectID int64 `gorm:"column:project_id;type:integer;not null;index:time_reservations_account,priority:2;index:time_period_project,priority:2"` |
| 187 | JobID int64 `gorm:"column:job_id;type:integer;not null"` |
| 188 | Period string `gorm:"column:period;type:text;not null;index:time_reservations_account,priority:4;index:time_period_account,priority:3;index:time_period_project,priority:4"` |
| 189 | ReservedSeconds int64 `gorm:"column:reserved_seconds;type:integer;not null"` |
| 190 | SettledSeconds int64 `gorm:"column:settled_seconds;type:integer;not null"` |
| 191 | State string `gorm:"column:state;type:text;not null;index:time_reservations_account,priority:3;index:time_period_account,priority:2;index:time_period_project,priority:3"` |
| 192 | SettledAt string `gorm:"column:settled_at;type:text;not null"` |
| 193 | } |
| 194 | |
| 195 | func (executionTimeReservations) TableName() string { return "time_reservations" } |
| 196 | |
| 197 | var executionModels = []any{&executionCoordinatorLimits{}, &executionGrantFences{}, &executionRecoveryCharges{}, &executionRecoveryEvents{}, &executionActions{}, &executionArtifacts{}, &executionAttempts{}, &executionEvents{}, &executionJobs{}, &executionPeriodBudgets{}, &executionReservations{}, &executionService{}, &executionSteps{}, &executionTimeReservations{}} |
| 198 | |
| 199 | type executionGrantFences struct { |
| 200 | Ref string `gorm:"type:text;primaryKey"` |
| 201 | Version int64 `gorm:"type:integer;not null"` |
| 202 | Epoch int64 `gorm:"type:integer;not null"` |
| 203 | } |
| 204 | |
| 205 | func (executionGrantFences) TableName() string { return "grant_fences" } |
| 206 | |
| 207 | type executionRecoveryCharges struct { |
| 208 | Key string `gorm:"type:text;primaryKey"` |
| 209 | Account string `gorm:"type:text;not null;index:recovery_charges_scope,priority:1"` |
| 210 | ProjectID int64 `gorm:"type:integer;not null;index:recovery_charges_scope,priority:2"` |
| 211 | Reserved string `gorm:"type:text;not null"` |
| 212 | Actor string `gorm:"type:text;not null"` |
| 213 | Reason string `gorm:"type:text;not null"` |
| 214 | Incarnation int64 `gorm:"type:integer;not null"` |
| 215 | CreatedAt string `gorm:"type:text;not null"` |
| 216 | } |
| 217 | |
| 218 | func (executionRecoveryCharges) TableName() string { return "recovery_charges" } |
| 219 | |
| 220 | type executionRecoveryEvents struct { |
| 221 | Revision int64 `gorm:"type:integer;primaryKey;autoIncrement:false"` |
| 222 | Kind string `gorm:"type:text;not null"` |
| 223 | Actor string `gorm:"type:text;not null"` |
| 224 | Reason string `gorm:"type:text;not null"` |
| 225 | SnapshotHash string `gorm:"type:text;not null"` |
| 226 | } |
| 227 | |
| 228 | func (executionRecoveryEvents) TableName() string { return "recovery_events" } |
| 229 | |
| 230 | type executionCoordinatorLimits struct { |
| 231 | Account string `gorm:"primaryKey;type:text;not null"` |
| 232 | Person string `gorm:"primaryKey;type:text;not null"` |
| 233 | Revision int64 `gorm:"type:integer;not null"` |
| 234 | Limits string `gorm:"type:text;not null"` |
| 235 | ContentHash string `gorm:"type:text;not null"` |
| 236 | } |
| 237 | |
| 238 | func (executionCoordinatorLimits) TableName() string { return "coordinator_limits" } |
| 239 | |