-- records table schema
CREATE TABLE api.records (
  id INT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
  url TEXT NOT NULL,
  discord_message_id TEXT NOT NULL,
  recording_state TEXT NOT NULL DEFAULT 'pending',
  file_size BIGINT NOT NULL DEFAULT 0,
  is_aborted BOOLEAN NOT NULL DEFAULT FALSE
);

-- roles & permissions for our backend automation user
GRANT all ON api.records TO automation;
GRANT SELECT ON api.records TO web_anon;