// @generated automatically by Diesel CLI.

diesel::table! {
    api_keys (id) {
        id -> Uuid,
        team_id -> Uuid,
        created_at -> Timestamptz,
        last_used_at -> Nullable<Timestamptz>,
    }
}

diesel::table! {
    browser_sessions (id) {
        id -> Text,
        serialized -> Text,
        created_at -> Timestamptz,
        expiry -> Nullable<Timestamptz>,
    }
}

diesel::table! {
    channel_selections (project_id, channel_id) {
        project_id -> Uuid,
        channel_id -> Uuid,
    }
}

diesel::table! {
    channels (id) {
        id -> Uuid,
        team_id -> Uuid,
        name -> Text,
        enable_by_default -> Bool,
        backend_config -> Jsonb,
    }
}

diesel::table! {
    csrf_tokens (id) {
        id -> Uuid,
        user_id -> Nullable<Uuid>,
        created_at -> Timestamptz,
    }
}

diesel::table! {
    governor_entries (id) {
        id -> Uuid,
        governor_id -> Uuid,
        timestamp -> Timestamptz,
    }
}

diesel::table! {
    governors (id) {
        id -> Uuid,
        team_id -> Uuid,
        project_id -> Nullable<Uuid>,
        window_size -> Interval,
        max_count -> Int4,
        rolling_count -> Int4,
    }
}

diesel::table! {
    messages (id) {
        id -> Uuid,
        channel_id -> Uuid,
        project_id -> Uuid,
        created_at -> Timestamptz,
        sent_at -> Nullable<Timestamptz>,
        message -> Text,
    }
}

diesel::table! {
    projects (id) {
        id -> Uuid,
        team_id -> Uuid,
        name -> Text,
    }
}

diesel::table! {
    team_memberships (team_id, user_id) {
        team_id -> Uuid,
        user_id -> Uuid,
    }
}

diesel::table! {
    teams (id) {
        id -> Uuid,
        name -> Text,
    }
}

diesel::table! {
    users (id) {
        id -> Uuid,
        uid -> Text,
        email -> Text,
    }
}

diesel::joinable!(api_keys -> teams (team_id));
diesel::joinable!(channel_selections -> channels (channel_id));
diesel::joinable!(channel_selections -> projects (project_id));
diesel::joinable!(channels -> teams (team_id));
diesel::joinable!(csrf_tokens -> users (user_id));
diesel::joinable!(governor_entries -> governors (governor_id));
diesel::joinable!(governors -> projects (project_id));
diesel::joinable!(governors -> teams (team_id));
diesel::joinable!(messages -> channels (channel_id));
diesel::joinable!(messages -> projects (project_id));
diesel::joinable!(projects -> teams (team_id));
diesel::joinable!(team_memberships -> teams (team_id));
diesel::joinable!(team_memberships -> users (user_id));

diesel::allow_tables_to_appear_in_same_query!(
    api_keys,
    browser_sessions,
    channel_selections,
    channels,
    csrf_tokens,
    governor_entries,
    governors,
    messages,
    projects,
    team_memberships,
    teams,
    users,
);
