ALTER TABLE gateway.api_keys
    ADD COLUMN IF NOT EXISTS created_by uuid REFERENCES gateway.admin_accounts(id);

CREATE INDEX IF NOT EXISTS api_keys_created_by_idx
    ON gateway.api_keys (created_by, created_at DESC);

COMMENT ON COLUMN gateway.api_keys.created_by IS
    'Administrator that created the key. Key material is returned once and never stored in plaintext.';
