mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
feat(gateway): unify background task runtime and storage
This commit is contained in:
159
crates/aether-data/schema/logical/008_background_tasks.toml
Normal file
159
crates/aether-data/schema/logical/008_background_tasks.toml
Normal file
@@ -0,0 +1,159 @@
|
||||
[table.background_task_runs]
|
||||
domain = "background_tasks"
|
||||
order = 10
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.background_task_runs.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.background_task_runs.columns]]
|
||||
name = "task_key"
|
||||
type = "text"
|
||||
length = 200
|
||||
|
||||
[[table.background_task_runs.columns]]
|
||||
name = "kind"
|
||||
type = "text"
|
||||
length = 32
|
||||
|
||||
[[table.background_task_runs.columns]]
|
||||
name = "trigger"
|
||||
type = "text"
|
||||
length = 64
|
||||
|
||||
[[table.background_task_runs.columns]]
|
||||
name = "status"
|
||||
type = "text"
|
||||
length = 32
|
||||
|
||||
[[table.background_task_runs.columns]]
|
||||
name = "attempt"
|
||||
type = "int32"
|
||||
default = 0
|
||||
|
||||
[[table.background_task_runs.columns]]
|
||||
name = "max_attempts"
|
||||
type = "int32"
|
||||
default = 0
|
||||
|
||||
[[table.background_task_runs.columns]]
|
||||
name = "owner_instance"
|
||||
type = "text"
|
||||
length = 200
|
||||
nullable = true
|
||||
|
||||
[[table.background_task_runs.columns]]
|
||||
name = "progress_percent"
|
||||
type = "int32"
|
||||
default = 0
|
||||
|
||||
[[table.background_task_runs.columns]]
|
||||
name = "progress_message"
|
||||
type = "text"
|
||||
nullable = true
|
||||
|
||||
[[table.background_task_runs.columns]]
|
||||
name = "payload_json"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.background_task_runs.columns]]
|
||||
name = "result_json"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.background_task_runs.columns]]
|
||||
name = "error_message"
|
||||
type = "text"
|
||||
nullable = true
|
||||
|
||||
[[table.background_task_runs.columns]]
|
||||
name = "cancel_requested"
|
||||
type = "bool"
|
||||
default = false
|
||||
|
||||
[[table.background_task_runs.columns]]
|
||||
name = "created_by"
|
||||
type = "text"
|
||||
length = 200
|
||||
nullable = true
|
||||
|
||||
[[table.background_task_runs.columns]]
|
||||
name = "created_at_unix_secs"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.background_task_runs.columns]]
|
||||
name = "started_at_unix_secs"
|
||||
type = "unix_seconds"
|
||||
nullable = true
|
||||
|
||||
[[table.background_task_runs.columns]]
|
||||
name = "finished_at_unix_secs"
|
||||
type = "unix_seconds"
|
||||
nullable = true
|
||||
|
||||
[[table.background_task_runs.columns]]
|
||||
name = "updated_at_unix_secs"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.background_task_runs.indexes]]
|
||||
name = "idx_background_task_runs_task_key"
|
||||
columns = ["task_key"]
|
||||
|
||||
[[table.background_task_runs.indexes]]
|
||||
name = "idx_background_task_runs_status"
|
||||
columns = ["status"]
|
||||
|
||||
[[table.background_task_runs.indexes]]
|
||||
name = "idx_background_task_runs_kind"
|
||||
columns = ["kind"]
|
||||
|
||||
[[table.background_task_runs.indexes]]
|
||||
name = "idx_background_task_runs_created_at"
|
||||
columns = ["created_at_unix_secs"]
|
||||
|
||||
[table.background_task_events]
|
||||
domain = "background_tasks"
|
||||
order = 20
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.background_task_events.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.background_task_events.columns]]
|
||||
name = "run_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.background_task_events.columns]]
|
||||
name = "event_type"
|
||||
type = "text"
|
||||
length = 64
|
||||
|
||||
[[table.background_task_events.columns]]
|
||||
name = "message"
|
||||
type = "text"
|
||||
|
||||
[[table.background_task_events.columns]]
|
||||
name = "payload_json"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.background_task_events.columns]]
|
||||
name = "created_at_unix_secs"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.background_task_events.indexes]]
|
||||
name = "idx_background_task_events_run_id"
|
||||
columns = ["run_id", "created_at_unix_secs"]
|
||||
|
||||
[[table.background_task_events.foreign_keys]]
|
||||
name = "fk_background_task_events_run"
|
||||
columns = ["run_id"]
|
||||
references_table = "background_task_runs"
|
||||
references_columns = ["id"]
|
||||
on_delete = "cascade"
|
||||
Reference in New Issue
Block a user