panel — open-source game server manager (public release)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
-- 004_event_triggers.sql — event-driven schedule triggers.
|
||||
--
|
||||
-- Until now schedules only supported cron. This migration adds:
|
||||
-- * trigger_kind = 'event' schedules, powered by a CEL expression over
|
||||
-- the event bus. Example: players_online == 0
|
||||
-- * optional sustained-state: fire only after the condition has been
|
||||
-- continuously true for N seconds. Enables "idle shutdown if 0 players
|
||||
-- for 30m" without firing every 60s when the polled player count is 0.
|
||||
--
|
||||
-- cron_spec becomes nullable so event triggers can exist with NULL there.
|
||||
-- Exactly one of cron_spec / event_spec is populated; the application
|
||||
-- enforces this.
|
||||
|
||||
ALTER TABLE schedules ALTER COLUMN cron_spec DROP NOT NULL;
|
||||
|
||||
ALTER TABLE schedules
|
||||
ADD COLUMN event_spec TEXT,
|
||||
ADD COLUMN event_sustained_seconds INTEGER NOT NULL DEFAULT 0;
|
||||
|
||||
CREATE INDEX idx_schedules_trigger_kind ON schedules(trigger_kind);
|
||||
Reference in New Issue
Block a user