This commit is contained in:
@@ -3096,6 +3096,21 @@ CREATE TABLE IF NOT EXISTS snapshot_runs (
|
||||
return nil
|
||||
}
|
||||
|
||||
// EnsureCronStatusTable creates a table to track cron job progress/status.
|
||||
func EnsureCronStatusTable(ctx context.Context, dbConn *sqlx.DB) error {
|
||||
ddl := `
|
||||
CREATE TABLE IF NOT EXISTS cron_status (
|
||||
job_name TEXT PRIMARY KEY,
|
||||
started_at BIGINT NOT NULL,
|
||||
ended_at BIGINT NOT NULL,
|
||||
duration_ms BIGINT NOT NULL,
|
||||
last_error TEXT,
|
||||
in_progress BOOLEAN NOT NULL DEFAULT FALSE
|
||||
);`
|
||||
_, err := execLog(ctx, dbConn, ddl)
|
||||
return err
|
||||
}
|
||||
|
||||
// UpsertSnapshotRun updates or inserts snapshot run status.
|
||||
func UpsertSnapshotRun(ctx context.Context, dbConn *sqlx.DB, vcenter string, snapshotTime time.Time, success bool, errMsg string) error {
|
||||
if err := EnsureSnapshotRunTable(ctx, dbConn); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user