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 fix-management-token-oauth-jsonb
# Conflicts: # crates/aether-data/src/lifecycle/bootstrap/postgres.rs # crates/aether-data/src/lifecycle/migrate/tests.rs
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
CREATE TABLE IF NOT EXISTS background_task_runs (
|
||||
id VARCHAR(64) PRIMARY KEY,
|
||||
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 NULL,
|
||||
finished_at_unix_secs BIGINT NULL,
|
||||
updated_at_unix_secs BIGINT NOT NULL,
|
||||
INDEX idx_background_task_runs_task_key (task_key),
|
||||
INDEX idx_background_task_runs_status (status),
|
||||
INDEX idx_background_task_runs_kind (kind),
|
||||
INDEX idx_background_task_runs_created_at (created_at_unix_secs)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS background_task_events (
|
||||
id VARCHAR(64) PRIMARY KEY,
|
||||
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,
|
||||
INDEX 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
|
||||
);
|
||||
@@ -0,0 +1,42 @@
|
||||
CREATE TABLE IF NOT EXISTS 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 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 DESC);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS background_task_events (
|
||||
id character varying(64) PRIMARY KEY,
|
||||
run_id character varying(64) NOT NULL REFERENCES 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 background_task_events (run_id, created_at_unix_secs ASC);
|
||||
@@ -0,0 +1,43 @@
|
||||
CREATE TABLE IF NOT EXISTS background_task_runs (
|
||||
id TEXT PRIMARY KEY,
|
||||
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 DESC);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS background_task_events (
|
||||
id TEXT PRIMARY KEY,
|
||||
run_id TEXT NOT NULL,
|
||||
event_type TEXT NOT NULL,
|
||||
message TEXT NOT NULL,
|
||||
payload_json TEXT,
|
||||
created_at_unix_secs INTEGER NOT NULL,
|
||||
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 ASC);
|
||||
Reference in New Issue
Block a user