Files
Chronos/src/Chronos.Data/Migrations/postgres/0007_schedules.sql
T
Alby96andClaude Opus 5.5 af9eeaab9b
CI / Build and test (push) Successful in 7m0s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 6s
Release / Build, test and publish (push) Successful in 13m28s
CI / PostgreSQL 16 integration (push) Successful in 5m52s
CI / PostgreSQL 17 integration (push) Successful in 4m50s
CI / Docker image (push) Successful in 1m4s
Release / Server image (push) Successful in 1m35s
feat: owner review 2 phase 2: scheduled jobs and log settings (#10)
- Jobs > Scheduled on the desktop and the admin panel. Every timer that queued work is now a visible system schedule: archive scan, upload clean-up, index backup, job-history and audit clean-ups, desktop housekeeping. New actions: verify, thumbnails, proxies, analysis, maintenance, backup, clean-ups, reports.
- The scheduler: migration 0007, in-house recurrence, compare-and-set claim, catch-up, scan at start.
- Log settings: levels, retention, size parts, total limit, daily or hourly rotation, audit retention, diagnostics share; the server writes Debug/Trace to its files again; logging never fails a job.

Upgrade: CHRONOS_LOG_LEVEL set in an existing container locks both levels; migration 0007 is one-way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
2026-10-27 11:19:26 +01:00

28 lines
1.2 KiB
SQL

-- Scheduled jobs (owner review 2, R10): one row per schedule, the timers a host used to run out of sight included as
-- system schedules (system_key set, seeded by the host at start, never here). next_run is claimed by compare-and-set,
-- so one process fires each run. Jobs remember the schedule that queued them. Mirrors sqlite/0007_schedules.sql.
CREATE TABLE schedules (
id uuid NOT NULL PRIMARY KEY,
system_key text COLLATE "C" UNIQUE,
name text NOT NULL,
action text NOT NULL,
target text NOT NULL DEFAULT 'current',
parameters_json jsonb,
recurrence text NOT NULL,
catch_up boolean NOT NULL DEFAULT TRUE,
priority integer NOT NULL DEFAULT 0,
enabled boolean NOT NULL DEFAULT TRUE,
next_run timestamptz,
last_run timestamptz,
last_job_id uuid,
last_outcome text,
created_by uuid,
created timestamptz NOT NULL,
updated timestamptz NOT NULL
);
CREATE INDEX ix_schedules_due ON schedules (enabled, next_run);
ALTER TABLE jobs ADD COLUMN schedule_id uuid;
CREATE INDEX ix_jobs_schedule ON jobs (schedule_id, created);