diff --git a/crates/db_schema/src/source/combined/search.rs b/crates/db_schema/src/source/combined/search.rs new file mode 100644 index 000000000..f5b2f9a5d --- /dev/null +++ b/crates/db_schema/src/source/combined/search.rs @@ -0,0 +1,27 @@ +use crate::newtypes::{CommentId, CommunityId, PersonId, PostId, SearchCombinedId}; +#[cfg(feature = "full")] +use crate::schema::search_combined; +use chrono::{DateTime, Utc}; +#[cfg(feature = "full")] +use i_love_jesus::CursorKeysModule; +use serde::{Deserialize, Serialize}; +use serde_with::skip_serializing_none; + +#[skip_serializing_none] +#[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)] +#[cfg_attr( + feature = "full", + derive(Identifiable, Queryable, Selectable, CursorKeysModule) +)] +#[cfg_attr(feature = "full", diesel(table_name = search_combined))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] +#[cfg_attr(feature = "full", cursor_keys_module(name = search_combined_keys))] +/// A combined table for a search (posts, comments, communities, persons) +pub struct SearchCombined { + pub id: SearchCombinedId, + pub published: DateTime, + pub post_id: Option, + pub comment_id: Option, + pub community_id: Option, + pub person_id: Option, +}