mirror of
https://github.com/Dvorinka/Containr.git
synced 2026-10-28 07:41:27 +00:00
refactor(db): port cron jobs to sqlc
Tranche 6 — 15 of 17 raw sites in cron.go. Adds cron_jobs and cron_executions to schema.sql and a full query set: job CRUD, owner joins (via project and via service), execution list/insert/finish, due-job scan for the scheduler, run bookkeeping, and retention trim. The filtered list query and the sparse UPDATE builder stay raw — both are genuinely dynamic. Go models keep string IDs; cronJobFrom and cronExecutionFrom map uuid/null types at the boundary. TestCronLiveInvariants covers insert/read, both owner joins, the trigger read, execution lifecycle, retention trim, and delete on live Postgres. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
ce71b5af24
commit
2978992e12
7 files changed
+729
-119
No files matched your search
@@ -98,6 +98,34 @@ type ContainerInstance struct {
|
||||
UpdatedAt sql.NullTime `json:"updated_at"`
|
||||
}
|
||||
|
||||
type CronExecution struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
CronJobID uuid.UUID `json:"cron_job_id"`
|
||||
StartedAt time.Time `json:"started_at"`
|
||||
FinishedAt sql.NullTime `json:"finished_at"`
|
||||
Status sql.NullString `json:"status"`
|
||||
Output sql.NullString `json:"output"`
|
||||
Error sql.NullString `json:"error"`
|
||||
}
|
||||
|
||||
type CronJob struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
ProjectID uuid.UUID `json:"project_id"`
|
||||
ServiceID uuid.UUID `json:"service_id"`
|
||||
Name string `json:"name"`
|
||||
Schedule string `json:"schedule"`
|
||||
Command string `json:"command"`
|
||||
Timezone sql.NullString `json:"timezone"`
|
||||
Enabled sql.NullBool `json:"enabled"`
|
||||
LastRunAt sql.NullTime `json:"last_run_at"`
|
||||
NextRunAt sql.NullTime `json:"next_run_at"`
|
||||
LastStatus sql.NullString `json:"last_status"`
|
||||
LastOutput sql.NullString `json:"last_output"`
|
||||
Retention sql.NullInt32 `json:"retention"`
|
||||
CreatedAt sql.NullTime `json:"created_at"`
|
||||
UpdatedAt sql.NullTime `json:"updated_at"`
|
||||
}
|
||||
|
||||
type DatabaseBackup struct {
|
||||
ID string `json:"id"`
|
||||
DatabaseID string `json:"database_id"`
|
||||
|
||||
Reference in new issue
Block a user