mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
Merge remote-tracking branch 'upstream/aether-rust-pioneer' into codex/user-groups-default-permissions
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
CREATE TABLE IF NOT EXISTS public.background_task_runs (
|
||||
id character varying(64) PRIMARY KEY,
|
||||
task_key character varying(200) NOT NULL,
|
||||
kind character varying(32) NOT NULL,
|
||||
"trigger" character varying(64) NOT NULL,
|
||||
status character varying(32) NOT NULL,
|
||||
attempt integer NOT NULL DEFAULT 0,
|
||||
max_attempts integer NOT NULL DEFAULT 0,
|
||||
owner_instance character varying(200),
|
||||
progress_percent integer NOT NULL DEFAULT 0,
|
||||
progress_message text,
|
||||
payload_json jsonb,
|
||||
result_json jsonb,
|
||||
error_message text,
|
||||
cancel_requested boolean NOT NULL DEFAULT false,
|
||||
created_by character varying(200),
|
||||
created_at_unix_secs bigint NOT NULL,
|
||||
started_at_unix_secs bigint,
|
||||
finished_at_unix_secs bigint,
|
||||
updated_at_unix_secs bigint NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_background_task_runs_task_key
|
||||
ON public.background_task_runs (task_key);
|
||||
CREATE INDEX IF NOT EXISTS idx_background_task_runs_status
|
||||
ON public.background_task_runs (status);
|
||||
CREATE INDEX IF NOT EXISTS idx_background_task_runs_kind
|
||||
ON public.background_task_runs (kind);
|
||||
CREATE INDEX IF NOT EXISTS idx_background_task_runs_created_at
|
||||
ON public.background_task_runs (created_at_unix_secs DESC);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS public.background_task_events (
|
||||
id character varying(64) PRIMARY KEY,
|
||||
run_id character varying(64) NOT NULL REFERENCES public.background_task_runs(id) ON DELETE CASCADE,
|
||||
event_type character varying(64) NOT NULL,
|
||||
message text NOT NULL,
|
||||
payload_json jsonb,
|
||||
created_at_unix_secs bigint NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_background_task_events_run_id
|
||||
ON public.background_task_events (run_id, created_at_unix_secs ASC);
|
||||
@@ -9,3 +9,4 @@
|
||||
120_stats_rollups.sql
|
||||
130_stats_cost_savings.sql
|
||||
140_proxy_node_metrics.sql
|
||||
150_background_tasks.sql
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
-- Generated by aether-data-schema from schema/logical/*.toml.
|
||||
-- Do not edit generated files directly; edit logical schema or explicit overrides instead.
|
||||
|
||||
CREATE TABLE IF NOT EXISTS background_task_runs (
|
||||
`id` VARCHAR(64) NOT NULL,
|
||||
`task_key` VARCHAR(200) NOT NULL,
|
||||
`kind` VARCHAR(32) NOT NULL,
|
||||
`trigger` VARCHAR(64) NOT NULL,
|
||||
`status` VARCHAR(32) NOT NULL,
|
||||
`attempt` INT NOT NULL DEFAULT 0,
|
||||
`max_attempts` INT NOT NULL DEFAULT 0,
|
||||
`owner_instance` VARCHAR(200),
|
||||
`progress_percent` INT NOT NULL DEFAULT 0,
|
||||
`progress_message` TEXT,
|
||||
`payload_json` JSON,
|
||||
`result_json` JSON,
|
||||
`error_message` TEXT,
|
||||
`cancel_requested` TINYINT(1) NOT NULL DEFAULT 0,
|
||||
`created_by` VARCHAR(200),
|
||||
`created_at_unix_secs` BIGINT NOT NULL,
|
||||
`started_at_unix_secs` BIGINT,
|
||||
`finished_at_unix_secs` BIGINT,
|
||||
`updated_at_unix_secs` BIGINT NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY idx_background_task_runs_task_key (`task_key`),
|
||||
KEY idx_background_task_runs_status (`status`),
|
||||
KEY idx_background_task_runs_kind (`kind`),
|
||||
KEY idx_background_task_runs_created_at (`created_at_unix_secs`)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS background_task_events (
|
||||
`id` VARCHAR(64) NOT NULL,
|
||||
`run_id` VARCHAR(64) NOT NULL,
|
||||
`event_type` VARCHAR(64) NOT NULL,
|
||||
`message` TEXT NOT NULL,
|
||||
`payload_json` JSON,
|
||||
`created_at_unix_secs` BIGINT NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY idx_background_task_events_run_id (`run_id`, `created_at_unix_secs`),
|
||||
CONSTRAINT fk_background_task_events_run FOREIGN KEY (`run_id`) REFERENCES background_task_runs (`id`) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
@@ -8,3 +8,4 @@
|
||||
005_wallet_billing.sql
|
||||
006_usage.sql
|
||||
007_stats.sql
|
||||
008_background_tasks.sql
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
-- Generated by aether-data-schema from schema/logical/*.toml.
|
||||
-- Do not edit generated files directly; edit logical schema or explicit overrides instead.
|
||||
|
||||
CREATE TABLE IF NOT EXISTS public.background_task_runs (
|
||||
id character varying(64) NOT NULL,
|
||||
task_key character varying(200) NOT NULL,
|
||||
kind character varying(32) NOT NULL,
|
||||
trigger character varying(64) NOT NULL,
|
||||
status character varying(32) NOT NULL,
|
||||
attempt integer DEFAULT 0 NOT NULL,
|
||||
max_attempts integer DEFAULT 0 NOT NULL,
|
||||
owner_instance character varying(200),
|
||||
progress_percent integer DEFAULT 0 NOT NULL,
|
||||
progress_message text,
|
||||
payload_json jsonb,
|
||||
result_json jsonb,
|
||||
error_message text,
|
||||
cancel_requested boolean DEFAULT false NOT NULL,
|
||||
created_by character varying(200),
|
||||
created_at_unix_secs bigint NOT NULL,
|
||||
started_at_unix_secs bigint,
|
||||
finished_at_unix_secs bigint,
|
||||
updated_at_unix_secs bigint NOT NULL
|
||||
);
|
||||
|
||||
ALTER TABLE ONLY public.background_task_runs ADD CONSTRAINT background_task_runs_pkey PRIMARY KEY (id);
|
||||
CREATE INDEX IF NOT EXISTS idx_background_task_runs_task_key ON public.background_task_runs USING btree (task_key);
|
||||
CREATE INDEX IF NOT EXISTS idx_background_task_runs_status ON public.background_task_runs USING btree (status);
|
||||
CREATE INDEX IF NOT EXISTS idx_background_task_runs_kind ON public.background_task_runs USING btree (kind);
|
||||
CREATE INDEX IF NOT EXISTS idx_background_task_runs_created_at ON public.background_task_runs USING btree (created_at_unix_secs);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS public.background_task_events (
|
||||
id character varying(64) NOT NULL,
|
||||
run_id character varying(64) NOT NULL,
|
||||
event_type character varying(64) NOT NULL,
|
||||
message text NOT NULL,
|
||||
payload_json jsonb,
|
||||
created_at_unix_secs bigint NOT NULL
|
||||
);
|
||||
|
||||
ALTER TABLE ONLY public.background_task_events ADD CONSTRAINT background_task_events_pkey PRIMARY KEY (id);
|
||||
CREATE INDEX IF NOT EXISTS idx_background_task_events_run_id ON public.background_task_events USING btree (run_id, created_at_unix_secs);
|
||||
ALTER TABLE ONLY public.background_task_events ADD CONSTRAINT fk_background_task_events_run FOREIGN KEY (run_id) REFERENCES public.background_task_runs(id) ON DELETE CASCADE;
|
||||
|
||||
@@ -8,3 +8,4 @@
|
||||
005_wallet_billing.sql
|
||||
006_usage.sql
|
||||
007_stats.sql
|
||||
008_background_tasks.sql
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
-- Generated by aether-data-schema from schema/logical/*.toml.
|
||||
-- Do not edit generated files directly; edit logical schema or explicit overrides instead.
|
||||
|
||||
CREATE TABLE IF NOT EXISTS background_task_runs (
|
||||
id TEXT PRIMARY KEY NOT NULL,
|
||||
task_key TEXT NOT NULL,
|
||||
kind TEXT NOT NULL,
|
||||
trigger TEXT NOT NULL,
|
||||
status TEXT NOT NULL,
|
||||
attempt INTEGER NOT NULL DEFAULT 0,
|
||||
max_attempts INTEGER NOT NULL DEFAULT 0,
|
||||
owner_instance TEXT,
|
||||
progress_percent INTEGER NOT NULL DEFAULT 0,
|
||||
progress_message TEXT,
|
||||
payload_json TEXT,
|
||||
result_json TEXT,
|
||||
error_message TEXT,
|
||||
cancel_requested INTEGER NOT NULL DEFAULT 0,
|
||||
created_by TEXT,
|
||||
created_at_unix_secs INTEGER NOT NULL,
|
||||
started_at_unix_secs INTEGER,
|
||||
finished_at_unix_secs INTEGER,
|
||||
updated_at_unix_secs INTEGER NOT NULL
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_background_task_runs_task_key ON background_task_runs (task_key);
|
||||
CREATE INDEX IF NOT EXISTS idx_background_task_runs_status ON background_task_runs (status);
|
||||
CREATE INDEX IF NOT EXISTS idx_background_task_runs_kind ON background_task_runs (kind);
|
||||
CREATE INDEX IF NOT EXISTS idx_background_task_runs_created_at ON background_task_runs (created_at_unix_secs);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS background_task_events (
|
||||
id TEXT PRIMARY KEY NOT NULL,
|
||||
run_id TEXT NOT NULL,
|
||||
event_type TEXT NOT NULL,
|
||||
message TEXT NOT NULL,
|
||||
payload_json TEXT,
|
||||
created_at_unix_secs INTEGER NOT NULL,
|
||||
CONSTRAINT fk_background_task_events_run FOREIGN KEY (run_id) REFERENCES background_task_runs (id) ON DELETE CASCADE
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_background_task_events_run_id ON background_task_events (run_id, created_at_unix_secs);
|
||||
|
||||
@@ -8,3 +8,4 @@
|
||||
005_wallet_billing.sql
|
||||
006_usage.sql
|
||||
007_stats.sql
|
||||
008_background_tasks.sql
|
||||
|
||||
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