prefect server in zig
database#
sqlite via zqlite.
connection#
single global connection with mutex for thread safety. pragmas:
journal_mode=WALbusy_timeout=5000foreign_keys=ON
tables#
flow- flow definitionsflow_run- flow run instancesflow_run_state- state history (FK cascade delete)task_run- task run instancesevents- persisted events
query pattern#
functions take allocator, return arena-owned structs:
pub fn getFlowById(alloc: Allocator, id: []const u8) !?FlowRow
caller manages arena lifetime - typically request-scoped.
transactions#
explicit for multi-statement ops:
conn.transaction() catch |err| { ... };
errdefer conn.rollback();
// ... statements ...
conn.commit() catch |err| { ... };