lazyBoy/migrations/031_file_events.sql

13 lines
574 B
MySQL
Raw Permalink Normal View History

2026-09-11 02:47:43 +00:00
CREATE TABLE computer_file_events (
computer_id TEXT NOT NULL REFERENCES computers(id) ON DELETE CASCADE,
provider_ref TEXT NOT NULL,
generation INTEGER NOT NULL,
local_id BIGINT NOT NULL CHECK(local_id > 0),
operation_id TEXT NOT NULL REFERENCES computer_operations(id) ON DELETE CASCADE,
status TEXT NOT NULL,
payload JSONB NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
PRIMARY KEY(computer_id, provider_ref, generation, local_id)
);
CREATE INDEX computer_file_event_sequence ON computer_file_events(operation_id, local_id);