improve sqlite import
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-02-11 08:41:32 +11:00
parent 3e3d8c2eb0
commit a09d94a266
4 changed files with 31 additions and 2 deletions

View File

@@ -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 {