-- I forgot to actually create the new table
CREATE TABLE api.segments_stream_links (
  id int PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
  discord_message_id text NOT NULL,
  capture_job_id text NOT NULL
);


-- roles & permissions
GRANT all ON api.segments_stream_links TO automation;
GRANT SELECT ON api.segments_stream_links TO web_anon;


-- there is no s3_id in the segments run context so we don't need a column for it
ALTER TABLE IF EXISTS api.segments
  DROP COLUMN s3_id;
