diesel::table! {
    messages (id) {
        id -> Integer,
        session_id -> Integer,
        user -> Bool,
        tool -> Bool,
        reasoning -> Nullable<Text>,
        reasoning_complete -> Bool,
        content -> Text,
        system -> Bool,
        compaction -> Bool,
        compaction_tail_start -> Nullable<Integer>,
    }
}

diesel::table! {
    projects (id) {
        id -> Integer,
        name -> Text,
        path -> Text,
        collapsed -> Bool,
    }
}

diesel::table! {
    sessions (id) {
        id -> Integer,
        project_id -> Integer,
        title -> Text,
        context_used -> Integer,
        context_limit -> Integer,
        last_tokens_per_second -> Nullable<Float>,
        state -> Text,
        compacted_summary -> Nullable<Text>,
    }
}

diesel::joinable!(sessions -> projects (project_id));
diesel::joinable!(messages -> sessions (session_id));
diesel::allow_tables_to_appear_in_same_query!(messages, projects, sessions);
