CREATE TABLE authorized_fields (
    id SERIAL PRIMARY KEY,
    event_stream_id INTEGER NOT NULL,
    message_name VARCHAR(128) NOT NULL,
    field_name VARCHAR(128) NOT NULL,

    CONSTRAINT authorized_fields_event_type_id_fkey FOREIGN KEY (event_stream_id) REFERENCES event_streams (id)
        ON UPDATE CASCADE,
    UNIQUE (event_stream_id, message_name, field_name)
);