17 lines
869 B
SQL
17 lines
869 B
SQL
-- References only: never persist file contents in the control plane.
|
|
CREATE TABLE computer_file_dispatches (
|
|
operation_id TEXT PRIMARY KEY REFERENCES computer_operations(id) ON DELETE CASCADE,
|
|
computer_id TEXT NOT NULL REFERENCES computers(id) ON DELETE CASCADE,
|
|
bot_id TEXT NOT NULL REFERENCES bots(id) ON DELETE CASCADE,
|
|
provider_ref TEXT NOT NULL,
|
|
runner_computer_id TEXT NOT NULL,
|
|
generation INTEGER NOT NULL CHECK (generation > 0),
|
|
runner_operation_id TEXT NOT NULL,
|
|
request_hash TEXT NOT NULL,
|
|
action TEXT NOT NULL CHECK (action IN ('write','patch','move')),
|
|
metadata JSONB NOT NULL,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
UNIQUE (computer_id, provider_ref, generation, bot_id, runner_operation_id)
|
|
);
|
|
CREATE INDEX computer_file_dispatch_scope ON computer_file_dispatches(computer_id, generation, bot_id);
|