Files
iAs/service/migrations/20260601000003_scheduled_tasks.sql
T
2026-06-25 17:23:11 +08:00

21 lines
696 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- 定时任务表(Phase 6
CREATE TABLE IF NOT EXISTS scheduled_tasks (
id UUID PRIMARY KEY,
name TEXT NOT NULL UNIQUE,
description TEXT NOT NULL DEFAULT '',
user_id TEXT NOT NULL,
command TEXT NOT NULL,
shell TEXT NOT NULL DEFAULT '/bin/bash',
cwd TEXT NOT NULL DEFAULT '',
interval_seconds INTEGER NOT NULL,
enabled BOOLEAN NOT NULL DEFAULT true,
next_run_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
last_run_at TIMESTAMPTZ,
last_status TEXT,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE INDEX IF NOT EXISTS idx_scheduled_tasks_due
ON scheduled_tasks (enabled, next_run_at);