Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

441 B
Raw Blame
DROP VIEW IF EXISTS v_metabot_messages;

CREATE OR REPLACE VIEW v_metabot_messages AS
SELECT
    m.id                           AS message_id,
    m.conversation_id,
    m.created_at,
    m.role,
    m.profile_id,
    m.total_tokens,
    COALESCE(m.user_id, c.user_id) AS user_id,
    m.slack_msg_id,
    m.channel_id
FROM metabot_message m
JOIN metabot_conversation c
    ON c.id = m.conversation_id
WHERE m.forked_from_message_id IS NULL;