From 82b30b54676da0c0fae15bc12c50d8f8e82a8f9d Mon Sep 17 00:00:00 2001 From: Dessalines Date: Tue, 21 Nov 2023 08:42:28 -0500 Subject: [PATCH] Adding Selectable and diesel postgres backend check. (#4175) --- crates/db_schema/src/aggregates/structs.rs | 35 ++++++++++++--- crates/db_schema/src/source/activity.rs | 20 +++++---- crates/db_schema/src/source/actor_language.rs | 9 ++-- crates/db_schema/src/source/captcha_answer.rs | 6 ++- crates/db_schema/src/source/comment.rs | 18 ++++++-- crates/db_schema/src/source/comment_reply.rs | 6 ++- crates/db_schema/src/source/comment_report.rs | 6 ++- crates/db_schema/src/source/community.rs | 21 +++++++-- .../db_schema/src/source/community_block.rs | 6 ++- crates/db_schema/src/source/custom_emoji.rs | 6 ++- .../src/source/custom_emoji_keyword.rs | 6 ++- .../src/source/email_verification.rs | 5 ++- .../src/source/federation_allowlist.rs | 6 ++- .../src/source/federation_blocklist.rs | 6 ++- crates/db_schema/src/source/image_upload.rs | 6 ++- crates/db_schema/src/source/instance.rs | 1 + crates/db_schema/src/source/instance_block.rs | 6 ++- crates/db_schema/src/source/language.rs | 3 +- crates/db_schema/src/source/local_site.rs | 1 + .../src/source/local_site_rate_limit.rs | 3 +- crates/db_schema/src/source/local_user.rs | 3 +- .../src/source/local_user_language.rs | 6 +-- crates/db_schema/src/source/login_token.rs | 3 +- crates/db_schema/src/source/moderator.rs | 45 ++++++++++++------- .../src/source/password_reset_request.rs | 3 +- crates/db_schema/src/source/person.rs | 9 +++- crates/db_schema/src/source/person_block.rs | 6 ++- crates/db_schema/src/source/person_mention.rs | 6 ++- crates/db_schema/src/source/post.rs | 23 +++++++--- crates/db_schema/src/source/post_report.rs | 6 ++- .../db_schema/src/source/private_message.rs | 6 ++- .../src/source/private_message_report.rs | 6 ++- .../src/source/registration_application.rs | 3 +- crates/db_schema/src/source/secret.rs | 3 +- crates/db_schema/src/source/site.rs | 3 +- crates/db_schema/src/source/tagline.rs | 6 ++- crates/db_views/src/structs.rs | 12 ++++- crates/db_views_actor/src/structs.rs | 10 +++++ crates/db_views_moderator/src/structs.rs | 16 +++++++ 39 files changed, 274 insertions(+), 77 deletions(-) diff --git a/crates/db_schema/src/aggregates/structs.rs b/crates/db_schema/src/aggregates/structs.rs index 24b2d82c5..4dd57724c 100644 --- a/crates/db_schema/src/aggregates/structs.rs +++ b/crates/db_schema/src/aggregates/structs.rs @@ -13,10 +13,14 @@ use serde::{Deserialize, Serialize}; #[cfg(feature = "full")] use ts_rs::TS; #[derive(PartialEq, Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))] +#[cfg_attr( + feature = "full", + derive(Queryable, Selectable, Associations, Identifiable, TS) +)] #[cfg_attr(feature = "full", diesel(table_name = comment_aggregates))] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))] #[cfg_attr(feature = "full", diesel(primary_key(comment_id)))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// Aggregate data for a comment. pub struct CommentAggregates { @@ -34,7 +38,10 @@ pub struct CommentAggregates { } #[derive(PartialEq, Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))] +#[cfg_attr( + feature = "full", + derive(Queryable, Selectable, Associations, Identifiable, TS) +)] #[cfg_attr(feature = "full", diesel(table_name = community_aggregates))] #[cfg_attr( feature = "full", @@ -62,10 +69,14 @@ pub struct CommunityAggregates { } #[derive(PartialEq, Eq, Debug, Serialize, Deserialize, Clone, Default)] -#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))] +#[cfg_attr( + feature = "full", + derive(Queryable, Selectable, Associations, Identifiable, TS) +)] #[cfg_attr(feature = "full", diesel(table_name = person_aggregates))] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::person::Person)))] #[cfg_attr(feature = "full", diesel(primary_key(person_id)))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// Aggregate data for a person. pub struct PersonAggregates { @@ -79,10 +90,14 @@ pub struct PersonAggregates { } #[derive(PartialEq, Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))] +#[cfg_attr( + feature = "full", + derive(Queryable, Selectable, Associations, Identifiable, TS) +)] #[cfg_attr(feature = "full", diesel(table_name = post_aggregates))] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))] #[cfg_attr(feature = "full", diesel(primary_key(post_id)))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// Aggregate data for a post. pub struct PostAggregates { @@ -122,10 +137,14 @@ pub struct PostAggregates { } #[derive(PartialEq, Eq, Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] +#[cfg_attr( + feature = "full", + derive(Queryable, Selectable, Associations, Identifiable) +)] #[cfg_attr(feature = "full", diesel(table_name = person_post_aggregates))] #[cfg_attr(feature = "full", diesel(primary_key(person_id, post_id)))] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::person::Person)))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] /// Aggregate data for a person's post. pub struct PersonPostAggregates { pub person_id: PersonId, @@ -148,10 +167,14 @@ pub struct PersonPostAggregatesForm { } #[derive(PartialEq, Eq, Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))] +#[cfg_attr( + feature = "full", + derive(Queryable, Selectable, Associations, Identifiable, TS) +)] #[cfg_attr(feature = "full", diesel(table_name = site_aggregates))] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::site::Site)))] #[cfg_attr(feature = "full", diesel(primary_key(site_id)))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// Aggregate data for a site. pub struct SiteAggregates { diff --git a/crates/db_schema/src/source/activity.rs b/crates/db_schema/src/source/activity.rs index 6c297e886..6eb17f606 100644 --- a/crates/db_schema/src/source/activity.rs +++ b/crates/db_schema/src/source/activity.rs @@ -1,6 +1,6 @@ use crate::{ newtypes::{ActivityId, CommunityId, DbUrl}, - schema::sent_activity, + schema::{received_activity, sent_activity}, }; use chrono::{DateTime, Utc}; use diesel::{sql_types::Nullable, Queryable}; @@ -51,8 +51,10 @@ impl ActivitySendTargets { } } -#[derive(PartialEq, Eq, Debug, Queryable)] -#[diesel(table_name = sent_activity)] +#[derive(PartialEq, Eq, Debug)] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] +#[cfg_attr(feature = "full", diesel(table_name = sent_activity))] pub struct SentActivity { pub id: ActivityId, pub ap_id: DbUrl, @@ -66,8 +68,8 @@ pub struct SentActivity { pub actor_apub_id: Option, } -#[derive(Insertable)] -#[diesel(table_name = sent_activity)] +#[cfg_attr(feature = "full", derive(Insertable))] +#[cfg_attr(feature = "full", diesel(table_name = sent_activity))] pub struct SentActivityForm { pub ap_id: DbUrl, pub data: Value, @@ -87,10 +89,12 @@ pub enum ActorType { Person, } -#[derive(PartialEq, Eq, Debug, Queryable)] -#[diesel(table_name = received_activity)] +#[derive(PartialEq, Eq, Debug)] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))] +#[cfg_attr(feature = "full", diesel(primary_key(ap_id)))] +#[cfg_attr(feature = "full", diesel(table_name = received_activity))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] pub struct ReceivedActivity { - pub id: i64, pub ap_id: DbUrl, pub published: DateTime, } diff --git a/crates/db_schema/src/source/actor_language.rs b/crates/db_schema/src/source/actor_language.rs index b3da61abc..0b14b63c1 100644 --- a/crates/db_schema/src/source/actor_language.rs +++ b/crates/db_schema/src/source/actor_language.rs @@ -4,9 +4,10 @@ use crate::schema::local_user_language; use serde::{Deserialize, Serialize}; #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Identifiable))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))] #[cfg_attr(feature = "full", diesel(table_name = local_user_language))] #[cfg_attr(feature = "full", diesel(primary_key(local_user_id, language_id)))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] pub struct LocalUserLanguage { pub local_user_id: LocalUserId, pub language_id: LanguageId, @@ -24,9 +25,10 @@ pub struct LocalUserLanguageForm { use crate::schema::community_language; #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Identifiable))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))] #[cfg_attr(feature = "full", diesel(table_name = community_language))] #[cfg_attr(feature = "full", diesel(primary_key(community_id, language_id)))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] pub struct CommunityLanguage { pub community_id: CommunityId, pub language_id: LanguageId, @@ -44,9 +46,10 @@ pub struct CommunityLanguageForm { use crate::schema::site_language; #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Identifiable))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))] #[cfg_attr(feature = "full", diesel(table_name = site_language))] #[cfg_attr(feature = "full", diesel(primary_key(site_id, language_id)))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] pub struct SiteLanguage { pub site_id: SiteId, pub language_id: LanguageId, diff --git a/crates/db_schema/src/source/captcha_answer.rs b/crates/db_schema/src/source/captcha_answer.rs index 2660968ec..188368226 100644 --- a/crates/db_schema/src/source/captcha_answer.rs +++ b/crates/db_schema/src/source/captcha_answer.rs @@ -7,8 +7,9 @@ use uuid::Uuid; #[skip_serializing_none] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable))] #[cfg_attr(feature = "full", diesel(table_name = captcha_answer))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] pub struct CaptchaAnswer { pub uuid: Uuid, pub answer: String, @@ -17,8 +18,9 @@ pub struct CaptchaAnswer { #[skip_serializing_none] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable))] #[cfg_attr(feature = "full", diesel(table_name = captcha_answer))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] pub struct CheckCaptchaAnswer { pub uuid: Uuid, pub answer: String, diff --git a/crates/db_schema/src/source/comment.rs b/crates/db_schema/src/source/comment.rs index 4969968be..3ebea42c1 100644 --- a/crates/db_schema/src/source/comment.rs +++ b/crates/db_schema/src/source/comment.rs @@ -14,10 +14,14 @@ use typed_builder::TypedBuilder; #[skip_serializing_none] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))] +#[cfg_attr( + feature = "full", + derive(Queryable, Selectable, Associations, Identifiable, TS) +)] #[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))] #[cfg_attr(feature = "full", diesel(table_name = comment))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] /// A comment. pub struct Comment { pub id: CommentId, @@ -83,10 +87,14 @@ pub struct CommentUpdateForm { } #[derive(PartialEq, Eq, Debug, Clone)] -#[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations))] +#[cfg_attr( + feature = "full", + derive(Identifiable, Queryable, Selectable, Associations) +)] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))] #[cfg_attr(feature = "full", diesel(table_name = comment_like))] #[cfg_attr(feature = "full", diesel(primary_key(person_id, comment_id)))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] pub struct CommentLike { pub person_id: PersonId, pub comment_id: CommentId, @@ -106,10 +114,14 @@ pub struct CommentLikeForm { } #[derive(PartialEq, Eq, Debug)] -#[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations))] +#[cfg_attr( + feature = "full", + derive(Identifiable, Queryable, Selectable, Associations) +)] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))] #[cfg_attr(feature = "full", diesel(table_name = comment_saved))] #[cfg_attr(feature = "full", diesel(primary_key(person_id, comment_id)))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] pub struct CommentSaved { pub comment_id: CommentId, pub person_id: PersonId, diff --git a/crates/db_schema/src/source/comment_reply.rs b/crates/db_schema/src/source/comment_reply.rs index 30d4ae919..1f99ad076 100644 --- a/crates/db_schema/src/source/comment_reply.rs +++ b/crates/db_schema/src/source/comment_reply.rs @@ -7,9 +7,13 @@ use serde::{Deserialize, Serialize}; use ts_rs::TS; #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))] +#[cfg_attr( + feature = "full", + derive(Queryable, Selectable, Associations, Identifiable, TS) +)] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))] #[cfg_attr(feature = "full", diesel(table_name = comment_reply))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// A comment reply. pub struct CommentReply { diff --git a/crates/db_schema/src/source/comment_report.rs b/crates/db_schema/src/source/comment_report.rs index 23697adce..73dadc945 100644 --- a/crates/db_schema/src/source/comment_report.rs +++ b/crates/db_schema/src/source/comment_report.rs @@ -9,9 +9,13 @@ use ts_rs::TS; #[skip_serializing_none] #[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)] -#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))] +#[cfg_attr( + feature = "full", + derive(Queryable, Selectable, Associations, Identifiable, TS) +)] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))] #[cfg_attr(feature = "full", diesel(table_name = comment_report))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// A comment report. pub struct CommentReport { diff --git a/crates/db_schema/src/source/community.rs b/crates/db_schema/src/source/community.rs index 29663c81d..b6944b989 100644 --- a/crates/db_schema/src/source/community.rs +++ b/crates/db_schema/src/source/community.rs @@ -13,8 +13,9 @@ use typed_builder::TypedBuilder; #[skip_serializing_none] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))] #[cfg_attr(feature = "full", diesel(table_name = community))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// A community. pub struct Community { @@ -128,13 +129,17 @@ pub struct CommunityUpdateForm { } #[derive(PartialEq, Eq, Debug)] -#[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations))] +#[cfg_attr( + feature = "full", + derive(Identifiable, Queryable, Selectable, Associations) +)] #[cfg_attr( feature = "full", diesel(belongs_to(crate::source::community::Community)) )] #[cfg_attr(feature = "full", diesel(table_name = community_moderator))] #[cfg_attr(feature = "full", diesel(primary_key(person_id, community_id)))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] pub struct CommunityModerator { pub community_id: CommunityId, pub person_id: PersonId, @@ -150,13 +155,17 @@ pub struct CommunityModeratorForm { } #[derive(PartialEq, Eq, Debug)] -#[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations))] +#[cfg_attr( + feature = "full", + derive(Identifiable, Queryable, Selectable, Associations) +)] #[cfg_attr( feature = "full", diesel(belongs_to(crate::source::community::Community)) )] #[cfg_attr(feature = "full", diesel(table_name = community_person_ban))] #[cfg_attr(feature = "full", diesel(primary_key(person_id, community_id)))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] pub struct CommunityPersonBan { pub community_id: CommunityId, pub person_id: PersonId, @@ -174,13 +183,17 @@ pub struct CommunityPersonBanForm { } #[derive(PartialEq, Eq, Debug)] -#[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations))] +#[cfg_attr( + feature = "full", + derive(Identifiable, Queryable, Selectable, Associations) +)] #[cfg_attr( feature = "full", diesel(belongs_to(crate::source::community::Community)) )] #[cfg_attr(feature = "full", diesel(table_name = community_follower))] #[cfg_attr(feature = "full", diesel(primary_key(person_id, community_id)))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] pub struct CommunityFollower { pub community_id: CommunityId, pub person_id: PersonId, diff --git a/crates/db_schema/src/source/community_block.rs b/crates/db_schema/src/source/community_block.rs index 3154f1d77..7d43af173 100644 --- a/crates/db_schema/src/source/community_block.rs +++ b/crates/db_schema/src/source/community_block.rs @@ -5,13 +5,17 @@ use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] +#[cfg_attr( + feature = "full", + derive(Queryable, Selectable, Associations, Identifiable) +)] #[cfg_attr( feature = "full", diesel(belongs_to(crate::source::community::Community)) )] #[cfg_attr(feature = "full", diesel(table_name = community_block))] #[cfg_attr(feature = "full", diesel(primary_key(person_id, community_id)))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] pub struct CommunityBlock { pub person_id: PersonId, pub community_id: CommunityId, diff --git a/crates/db_schema/src/source/custom_emoji.rs b/crates/db_schema/src/source/custom_emoji.rs index 015004cae..3217c9736 100644 --- a/crates/db_schema/src/source/custom_emoji.rs +++ b/crates/db_schema/src/source/custom_emoji.rs @@ -10,12 +10,16 @@ use typed_builder::TypedBuilder; #[skip_serializing_none] #[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))] +#[cfg_attr( + feature = "full", + derive(Queryable, Selectable, Associations, Identifiable, TS) +)] #[cfg_attr(feature = "full", diesel(table_name = custom_emoji))] #[cfg_attr( feature = "full", diesel(belongs_to(crate::source::local_site::LocalSite)) )] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// A custom emoji. pub struct CustomEmoji { diff --git a/crates/db_schema/src/source/custom_emoji_keyword.rs b/crates/db_schema/src/source/custom_emoji_keyword.rs index 679bbccea..34ee071b5 100644 --- a/crates/db_schema/src/source/custom_emoji_keyword.rs +++ b/crates/db_schema/src/source/custom_emoji_keyword.rs @@ -7,13 +7,17 @@ use ts_rs::TS; use typed_builder::TypedBuilder; #[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))] +#[cfg_attr( + feature = "full", + derive(Queryable, Selectable, Associations, Identifiable, TS) +)] #[cfg_attr(feature = "full", diesel(table_name = custom_emoji_keyword))] #[cfg_attr( feature = "full", diesel(belongs_to(crate::source::custom_emoji::CustomEmoji)) )] #[cfg_attr(feature = "full", diesel(primary_key(custom_emoji_id, keyword)))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// A custom keyword for an emoji. pub struct CustomEmojiKeyword { diff --git a/crates/db_schema/src/source/email_verification.rs b/crates/db_schema/src/source/email_verification.rs index af117e0bd..201a4cef3 100644 --- a/crates/db_schema/src/source/email_verification.rs +++ b/crates/db_schema/src/source/email_verification.rs @@ -4,13 +4,14 @@ use crate::schema::email_verification; use chrono::{DateTime, Utc}; #[derive(Clone)] -#[cfg_attr(feature = "full", derive(Queryable, Identifiable))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))] #[cfg_attr(feature = "full", diesel(table_name = email_verification))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] pub struct EmailVerification { pub id: i32, pub local_user_id: LocalUserId, pub email: String, - pub verification_code: String, + pub verification_token: String, pub published: DateTime, } diff --git a/crates/db_schema/src/source/federation_allowlist.rs b/crates/db_schema/src/source/federation_allowlist.rs index 62ceb7d6f..cc66bcad8 100644 --- a/crates/db_schema/src/source/federation_allowlist.rs +++ b/crates/db_schema/src/source/federation_allowlist.rs @@ -6,13 +6,17 @@ use serde::{Deserialize, Serialize}; use std::fmt::Debug; #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] +#[cfg_attr( + feature = "full", + derive(Queryable, Selectable, Associations, Identifiable) +)] #[cfg_attr( feature = "full", diesel(belongs_to(crate::source::instance::Instance)) )] #[cfg_attr(feature = "full", diesel(table_name = federation_allowlist))] #[cfg_attr(feature = "full", diesel(primary_key(instance_id)))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] pub struct FederationAllowList { pub instance_id: InstanceId, pub published: DateTime, diff --git a/crates/db_schema/src/source/federation_blocklist.rs b/crates/db_schema/src/source/federation_blocklist.rs index 5f5bd835b..2176ce42d 100644 --- a/crates/db_schema/src/source/federation_blocklist.rs +++ b/crates/db_schema/src/source/federation_blocklist.rs @@ -6,13 +6,17 @@ use serde::{Deserialize, Serialize}; use std::fmt::Debug; #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] +#[cfg_attr( + feature = "full", + derive(Queryable, Selectable, Associations, Identifiable) +)] #[cfg_attr( feature = "full", diesel(belongs_to(crate::source::instance::Instance)) )] #[cfg_attr(feature = "full", diesel(table_name = federation_blocklist))] #[cfg_attr(feature = "full", diesel(primary_key(instance_id)))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] pub struct FederationBlockList { pub instance_id: InstanceId, pub published: DateTime, diff --git a/crates/db_schema/src/source/image_upload.rs b/crates/db_schema/src/source/image_upload.rs index db1b7800b..b72c55065 100644 --- a/crates/db_schema/src/source/image_upload.rs +++ b/crates/db_schema/src/source/image_upload.rs @@ -11,7 +11,10 @@ use typed_builder::TypedBuilder; #[skip_serializing_none] #[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))] +#[cfg_attr( + feature = "full", + derive(Queryable, Selectable, Associations, Identifiable, TS) +)] #[cfg_attr(feature = "full", diesel(table_name = image_upload))] #[cfg_attr(feature = "full", diesel(primary_key(pictrs_alias)))] #[cfg_attr(feature = "full", ts(export))] @@ -19,6 +22,7 @@ use typed_builder::TypedBuilder; feature = "full", diesel(belongs_to(crate::source::local_user::LocalUser)) )] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] pub struct ImageUpload { pub local_user_id: LocalUserId, pub pictrs_alias: String, diff --git a/crates/db_schema/src/source/instance.rs b/crates/db_schema/src/source/instance.rs index 8714b317e..98e0d401b 100644 --- a/crates/db_schema/src/source/instance.rs +++ b/crates/db_schema/src/source/instance.rs @@ -13,6 +13,7 @@ use typed_builder::TypedBuilder; #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))] #[cfg_attr(feature = "full", diesel(table_name = instance))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// A federated instance / site. pub struct Instance { diff --git a/crates/db_schema/src/source/instance_block.rs b/crates/db_schema/src/source/instance_block.rs index fe737ec6f..4eebbf1a8 100644 --- a/crates/db_schema/src/source/instance_block.rs +++ b/crates/db_schema/src/source/instance_block.rs @@ -5,13 +5,17 @@ use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] +#[cfg_attr( + feature = "full", + derive(Queryable, Selectable, Associations, Identifiable) +)] #[cfg_attr( feature = "full", diesel(belongs_to(crate::source::instance::Instance)) )] #[cfg_attr(feature = "full", diesel(table_name = instance_block))] #[cfg_attr(feature = "full", diesel(primary_key(person_id, instance_id)))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] pub struct InstanceBlock { pub person_id: PersonId, pub instance_id: InstanceId, diff --git a/crates/db_schema/src/source/language.rs b/crates/db_schema/src/source/language.rs index 3d3122da9..a816822e0 100644 --- a/crates/db_schema/src/source/language.rs +++ b/crates/db_schema/src/source/language.rs @@ -6,8 +6,9 @@ use serde::{Deserialize, Serialize}; use ts_rs::TS; #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))] #[cfg_attr(feature = "full", diesel(table_name = language))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// A language. pub struct Language { diff --git a/crates/db_schema/src/source/local_site.rs b/crates/db_schema/src/source/local_site.rs index 9187c6a09..ac545d574 100644 --- a/crates/db_schema/src/source/local_site.rs +++ b/crates/db_schema/src/source/local_site.rs @@ -17,6 +17,7 @@ use typed_builder::TypedBuilder; #[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] #[cfg_attr(feature = "full", diesel(table_name = local_site))] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::site::Site)))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// The local site. pub struct LocalSite { diff --git a/crates/db_schema/src/source/local_site_rate_limit.rs b/crates/db_schema/src/source/local_site_rate_limit.rs index 59da06270..6ba3df59e 100644 --- a/crates/db_schema/src/source/local_site_rate_limit.rs +++ b/crates/db_schema/src/source/local_site_rate_limit.rs @@ -10,13 +10,14 @@ use typed_builder::TypedBuilder; #[skip_serializing_none] #[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))] #[cfg_attr(feature = "full", diesel(table_name = local_site_rate_limit))] #[cfg_attr(feature = "full", diesel(primary_key(local_site_id)))] #[cfg_attr( feature = "full", diesel(belongs_to(crate::source::local_site::LocalSite)) )] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// Rate limits for your site. Given in count / length of time. pub struct LocalSiteRateLimit { diff --git a/crates/db_schema/src/source/local_user.rs b/crates/db_schema/src/source/local_user.rs index 5be2573b2..97a0921da 100644 --- a/crates/db_schema/src/source/local_user.rs +++ b/crates/db_schema/src/source/local_user.rs @@ -14,8 +14,9 @@ use typed_builder::TypedBuilder; #[skip_serializing_none] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))] #[cfg_attr(feature = "full", diesel(table_name = local_user))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// A local user. pub struct LocalUser { diff --git a/crates/db_schema/src/source/local_user_language.rs b/crates/db_schema/src/source/local_user_language.rs index b6129d0ce..83c666636 100644 --- a/crates/db_schema/src/source/local_user_language.rs +++ b/crates/db_schema/src/source/local_user_language.rs @@ -1,12 +1,12 @@ use crate::newtypes::{LanguageId, LocalUserId, LocalUserLanguageId}; -use serde::{Deserialize, Serialize}; - #[cfg(feature = "full")] use crate::schema::local_user_language; +use serde::{Deserialize, Serialize}; #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Identifiable))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))] #[cfg_attr(feature = "full", diesel(table_name = local_user_language))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] pub struct LocalUserLanguage { #[serde(skip)] pub id: LocalUserLanguageId, diff --git a/crates/db_schema/src/source/login_token.rs b/crates/db_schema/src/source/login_token.rs index 97a3bba53..e5d61f7c3 100644 --- a/crates/db_schema/src/source/login_token.rs +++ b/crates/db_schema/src/source/login_token.rs @@ -10,9 +10,10 @@ use ts_rs::TS; /// Stores data related to a specific user login session. #[skip_serializing_none] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))] #[cfg_attr(feature = "full", diesel(table_name = login_token))] #[cfg_attr(feature = "full", diesel(primary_key(token)))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] pub struct LoginToken { /// Jwt token for this login diff --git a/crates/db_schema/src/source/moderator.rs b/crates/db_schema/src/source/moderator.rs index 181bdbab7..c1f58ebc8 100644 --- a/crates/db_schema/src/source/moderator.rs +++ b/crates/db_schema/src/source/moderator.rs @@ -25,8 +25,9 @@ use ts_rs::TS; #[skip_serializing_none] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))] #[cfg_attr(feature = "full", diesel(table_name = mod_remove_post))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// When a moderator removes a post. pub struct ModRemovePost { @@ -48,8 +49,9 @@ pub struct ModRemovePostForm { } #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))] #[cfg_attr(feature = "full", diesel(table_name = mod_lock_post))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// When a moderator locks a post (prevents new comments being made). pub struct ModLockPost { @@ -69,8 +71,9 @@ pub struct ModLockPostForm { } #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))] #[cfg_attr(feature = "full", diesel(table_name = mod_feature_post))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// When a moderator features a post on a community (pins it to the top). pub struct ModFeaturePost { @@ -93,8 +96,9 @@ pub struct ModFeaturePostForm { #[skip_serializing_none] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))] #[cfg_attr(feature = "full", diesel(table_name = mod_remove_comment))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// When a moderator removes a comment. pub struct ModRemoveComment { @@ -117,8 +121,9 @@ pub struct ModRemoveCommentForm { #[skip_serializing_none] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))] #[cfg_attr(feature = "full", diesel(table_name = mod_remove_community))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// When a moderator removes a community. pub struct ModRemoveCommunity { @@ -141,8 +146,9 @@ pub struct ModRemoveCommunityForm { #[skip_serializing_none] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))] #[cfg_attr(feature = "full", diesel(table_name = mod_ban_from_community))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// When someone is banned from a community. pub struct ModBanFromCommunity { @@ -169,8 +175,9 @@ pub struct ModBanFromCommunityForm { #[skip_serializing_none] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))] #[cfg_attr(feature = "full", diesel(table_name = mod_ban))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// When someone is banned from the site. pub struct ModBan { @@ -194,8 +201,9 @@ pub struct ModHideCommunityForm { #[skip_serializing_none] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))] #[cfg_attr(feature = "full", diesel(table_name = mod_hide_community))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// When a community is hidden from public view. pub struct ModHideCommunity { @@ -218,8 +226,9 @@ pub struct ModBanForm { } #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))] #[cfg_attr(feature = "full", diesel(table_name = mod_add_community))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// When someone is added as a community moderator. pub struct ModAddCommunity { @@ -241,8 +250,9 @@ pub struct ModAddCommunityForm { } #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))] #[cfg_attr(feature = "full", diesel(table_name = mod_transfer_community))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// When a moderator transfers a community to a new owner. pub struct ModTransferCommunity { @@ -262,8 +272,9 @@ pub struct ModTransferCommunityForm { } #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))] #[cfg_attr(feature = "full", diesel(table_name = mod_add))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// When someone is added as a site moderator. pub struct ModAdd { @@ -284,8 +295,9 @@ pub struct ModAddForm { #[skip_serializing_none] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))] #[cfg_attr(feature = "full", diesel(table_name = admin_purge_person))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// When an admin purges a person. pub struct AdminPurgePerson { @@ -304,8 +316,9 @@ pub struct AdminPurgePersonForm { #[skip_serializing_none] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))] #[cfg_attr(feature = "full", diesel(table_name = admin_purge_community))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// When an admin purges a community. pub struct AdminPurgeCommunity { @@ -324,8 +337,9 @@ pub struct AdminPurgeCommunityForm { #[skip_serializing_none] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))] #[cfg_attr(feature = "full", diesel(table_name = admin_purge_post))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// When an admin purges a post. pub struct AdminPurgePost { @@ -346,8 +360,9 @@ pub struct AdminPurgePostForm { #[skip_serializing_none] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))] #[cfg_attr(feature = "full", diesel(table_name = admin_purge_comment))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// When an admin purges a comment. pub struct AdminPurgeComment { diff --git a/crates/db_schema/src/source/password_reset_request.rs b/crates/db_schema/src/source/password_reset_request.rs index 648c7164c..edc030e9c 100644 --- a/crates/db_schema/src/source/password_reset_request.rs +++ b/crates/db_schema/src/source/password_reset_request.rs @@ -4,8 +4,9 @@ use crate::schema::password_reset_request; use chrono::{DateTime, Utc}; #[derive(PartialEq, Eq, Debug)] -#[cfg_attr(feature = "full", derive(Queryable, Identifiable))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))] #[cfg_attr(feature = "full", diesel(table_name = password_reset_request))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] pub struct PasswordResetRequest { pub id: i32, pub token: String, diff --git a/crates/db_schema/src/source/person.rs b/crates/db_schema/src/source/person.rs index 657006f20..25e65ae79 100644 --- a/crates/db_schema/src/source/person.rs +++ b/crates/db_schema/src/source/person.rs @@ -13,8 +13,9 @@ use typed_builder::TypedBuilder; #[skip_serializing_none] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))] #[cfg_attr(feature = "full", diesel(table_name = person))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// A person. pub struct Person { @@ -112,10 +113,14 @@ pub struct PersonUpdateForm { } #[derive(PartialEq, Eq, Debug)] -#[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations))] +#[cfg_attr( + feature = "full", + derive(Identifiable, Queryable, Selectable, Associations) +)] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::person::Person)))] #[cfg_attr(feature = "full", diesel(table_name = person_follower))] #[cfg_attr(feature = "full", diesel(primary_key(follower_id, person_id)))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] pub struct PersonFollower { pub person_id: PersonId, pub follower_id: PersonId, diff --git a/crates/db_schema/src/source/person_block.rs b/crates/db_schema/src/source/person_block.rs index 3b22aec2c..43048fb39 100644 --- a/crates/db_schema/src/source/person_block.rs +++ b/crates/db_schema/src/source/person_block.rs @@ -5,10 +5,14 @@ use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] +#[cfg_attr( + feature = "full", + derive(Queryable, Selectable, Associations, Identifiable) +)] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::person::Person)))] #[cfg_attr(feature = "full", diesel(table_name = person_block))] #[cfg_attr(feature = "full", diesel(primary_key(person_id, target_id)))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] pub struct PersonBlock { pub person_id: PersonId, pub target_id: PersonId, diff --git a/crates/db_schema/src/source/person_mention.rs b/crates/db_schema/src/source/person_mention.rs index b9d7ccf8e..9c3005655 100644 --- a/crates/db_schema/src/source/person_mention.rs +++ b/crates/db_schema/src/source/person_mention.rs @@ -7,9 +7,13 @@ use serde::{Deserialize, Serialize}; use ts_rs::TS; #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))] +#[cfg_attr( + feature = "full", + derive(Queryable, Selectable, Associations, Identifiable, TS) +)] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))] #[cfg_attr(feature = "full", diesel(table_name = person_mention))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// A person mention. pub struct PersonMention { diff --git a/crates/db_schema/src/source/post.rs b/crates/db_schema/src/source/post.rs index 760697b0b..3b22a737a 100644 --- a/crates/db_schema/src/source/post.rs +++ b/crates/db_schema/src/source/post.rs @@ -10,9 +10,10 @@ use typed_builder::TypedBuilder; #[skip_serializing_none] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))] #[cfg_attr(feature = "full", diesel(table_name = post))] #[cfg_attr(feature = "full", ts(export))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] /// A post. pub struct Post { pub id: PostId, @@ -111,10 +112,14 @@ pub struct PostUpdateForm { } #[derive(PartialEq, Eq, Debug)] -#[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations))] +#[cfg_attr( + feature = "full", + derive(Identifiable, Queryable, Selectable, Associations) +)] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))] #[cfg_attr(feature = "full", diesel(table_name = post_like))] #[cfg_attr(feature = "full", diesel(primary_key(person_id, post_id)))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] pub struct PostLike { pub post_id: PostId, pub person_id: PersonId, @@ -132,10 +137,14 @@ pub struct PostLikeForm { } #[derive(PartialEq, Eq, Debug)] -#[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations))] +#[cfg_attr( + feature = "full", + derive(Identifiable, Queryable, Selectable, Associations) +)] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))] #[cfg_attr(feature = "full", diesel(table_name = post_saved))] #[cfg_attr(feature = "full", diesel(primary_key(post_id, person_id)))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] pub struct PostSaved { pub post_id: PostId, pub person_id: PersonId, @@ -150,11 +159,15 @@ pub struct PostSavedForm { } #[derive(PartialEq, Eq, Debug)] -#[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations))] +#[cfg_attr( + feature = "full", + derive(Identifiable, Queryable, Selectable, Associations) +)] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))] #[cfg_attr(feature = "full", diesel(table_name = post_read))] +#[cfg_attr(feature = "full", diesel(primary_key(post_id, person_id)))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] pub struct PostRead { - pub id: i32, pub post_id: PostId, pub person_id: PersonId, pub published: DateTime, diff --git a/crates/db_schema/src/source/post_report.rs b/crates/db_schema/src/source/post_report.rs index 9f5f53d95..9aee9ed97 100644 --- a/crates/db_schema/src/source/post_report.rs +++ b/crates/db_schema/src/source/post_report.rs @@ -9,9 +9,13 @@ use ts_rs::TS; #[skip_serializing_none] #[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)] -#[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations, TS))] +#[cfg_attr( + feature = "full", + derive(Identifiable, Queryable, Selectable, Associations, TS) +)] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))] // Is this the right assoc? #[cfg_attr(feature = "full", diesel(table_name = post_report))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// A post report. pub struct PostReport { diff --git a/crates/db_schema/src/source/private_message.rs b/crates/db_schema/src/source/private_message.rs index 033bfbe20..94a600921 100644 --- a/crates/db_schema/src/source/private_message.rs +++ b/crates/db_schema/src/source/private_message.rs @@ -10,12 +10,16 @@ use typed_builder::TypedBuilder; #[skip_serializing_none] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))] +#[cfg_attr( + feature = "full", + derive(Queryable, Selectable, Associations, Identifiable, TS) +)] #[cfg_attr( feature = "full", diesel(belongs_to(crate::source::person::Person, foreign_key = creator_id) ))] // Is this the right assoc? #[cfg_attr(feature = "full", diesel(table_name = private_message))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// A private message. pub struct PrivateMessage { diff --git a/crates/db_schema/src/source/private_message_report.rs b/crates/db_schema/src/source/private_message_report.rs index 0afc5b039..7b4c8c637 100644 --- a/crates/db_schema/src/source/private_message_report.rs +++ b/crates/db_schema/src/source/private_message_report.rs @@ -9,12 +9,16 @@ use ts_rs::TS; #[skip_serializing_none] #[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)] -#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))] +#[cfg_attr( + feature = "full", + derive(Queryable, Selectable, Associations, Identifiable, TS) +)] #[cfg_attr( feature = "full", diesel(belongs_to(crate::source::private_message::PrivateMessage)) )] #[cfg_attr(feature = "full", diesel(table_name = private_message_report))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// The private message report. pub struct PrivateMessageReport { diff --git a/crates/db_schema/src/source/registration_application.rs b/crates/db_schema/src/source/registration_application.rs index 1ed78703b..2824951d7 100644 --- a/crates/db_schema/src/source/registration_application.rs +++ b/crates/db_schema/src/source/registration_application.rs @@ -9,8 +9,9 @@ use ts_rs::TS; #[skip_serializing_none] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))] #[cfg_attr(feature = "full", diesel(table_name = registration_application))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// A registration application. pub struct RegistrationApplication { diff --git a/crates/db_schema/src/source/secret.rs b/crates/db_schema/src/source/secret.rs index 8b955ec59..164670a24 100644 --- a/crates/db_schema/src/source/secret.rs +++ b/crates/db_schema/src/source/secret.rs @@ -2,8 +2,9 @@ use crate::schema::secret; #[derive(Clone)] -#[cfg_attr(feature = "full", derive(Queryable, Identifiable))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))] #[cfg_attr(feature = "full", diesel(table_name = secret))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] pub struct Secret { pub id: i32, pub jwt_secret: String, diff --git a/crates/db_schema/src/source/site.rs b/crates/db_schema/src/source/site.rs index 0e175dc71..14b931847 100644 --- a/crates/db_schema/src/source/site.rs +++ b/crates/db_schema/src/source/site.rs @@ -10,8 +10,9 @@ use typed_builder::TypedBuilder; #[skip_serializing_none] #[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] +#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))] #[cfg_attr(feature = "full", diesel(table_name = site))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// The site. pub struct Site { diff --git a/crates/db_schema/src/source/tagline.rs b/crates/db_schema/src/source/tagline.rs index 564c6dc80..dbc904a78 100644 --- a/crates/db_schema/src/source/tagline.rs +++ b/crates/db_schema/src/source/tagline.rs @@ -9,12 +9,16 @@ use ts_rs::TS; #[skip_serializing_none] #[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)] -#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))] +#[cfg_attr( + feature = "full", + derive(Queryable, Selectable, Associations, Identifiable, TS) +)] #[cfg_attr(feature = "full", diesel(table_name = tagline))] #[cfg_attr( feature = "full", diesel(belongs_to(crate::source::local_site::LocalSite)) )] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// A tagline, shown at the top of your site. pub struct Tagline { diff --git a/crates/db_views/src/structs.rs b/crates/db_views/src/structs.rs index 2f65bb78f..25f1c608c 100644 --- a/crates/db_views/src/structs.rs +++ b/crates/db_views/src/structs.rs @@ -29,6 +29,7 @@ use ts_rs::TS; #[skip_serializing_none] #[derive(Debug, PartialEq, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// A comment report view. pub struct CommentReportView { @@ -47,6 +48,7 @@ pub struct CommentReportView { #[skip_serializing_none] #[derive(Debug, PartialEq, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// A comment view. pub struct CommentView { @@ -65,6 +67,7 @@ pub struct CommentView { #[derive(Debug, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// A local user view. pub struct LocalUserView { @@ -76,6 +79,7 @@ pub struct LocalUserView { #[skip_serializing_none] #[derive(Debug, PartialEq, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// A post report view. pub struct PostReportView { @@ -101,6 +105,7 @@ pub struct PaginationCursor(pub(crate) String); #[skip_serializing_none] #[derive(Debug, PartialEq, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// A post view. pub struct PostView { @@ -120,6 +125,7 @@ pub struct PostView { #[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// A private message view. pub struct PrivateMessageView { @@ -131,6 +137,7 @@ pub struct PrivateMessageView { #[skip_serializing_none] #[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// A private message report view. pub struct PrivateMessageReportView { @@ -144,6 +151,7 @@ pub struct PrivateMessageReportView { #[skip_serializing_none] #[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// A registration application view. pub struct RegistrationApplicationView { @@ -155,6 +163,7 @@ pub struct RegistrationApplicationView { #[derive(Debug, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// A site view. pub struct SiteView { @@ -165,7 +174,8 @@ pub struct SiteView { } #[derive(Debug, Serialize, Deserialize, Clone)] -#[cfg_attr(feature = "full", derive(TS))] +#[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// A custom emoji view. pub struct CustomEmojiView { diff --git a/crates/db_views_actor/src/structs.rs b/crates/db_views_actor/src/structs.rs index 88461701d..7b329004e 100644 --- a/crates/db_views_actor/src/structs.rs +++ b/crates/db_views_actor/src/structs.rs @@ -21,6 +21,7 @@ use ts_rs::TS; #[derive(Debug, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// A community block. pub struct CommunityBlockView { @@ -31,6 +32,7 @@ pub struct CommunityBlockView { #[skip_serializing_none] #[derive(Debug, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// An instance block by a user. pub struct InstanceBlockView { @@ -41,6 +43,7 @@ pub struct InstanceBlockView { #[derive(Debug, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// A community follower. pub struct CommunityFollowerView { @@ -50,6 +53,7 @@ pub struct CommunityFollowerView { #[derive(Debug, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// A community moderator. pub struct CommunityModeratorView { @@ -59,6 +63,7 @@ pub struct CommunityModeratorView { #[derive(Debug, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] /// A community person ban. pub struct CommunityPersonBanView { pub community: Community, @@ -67,6 +72,7 @@ pub struct CommunityPersonBanView { #[derive(Debug, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// A community view. pub struct CommunityView { @@ -78,6 +84,7 @@ pub struct CommunityView { #[derive(Debug, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// A person block. pub struct PersonBlockView { @@ -88,6 +95,7 @@ pub struct PersonBlockView { #[skip_serializing_none] #[derive(Debug, PartialEq, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// A person mention view. pub struct PersonMentionView { @@ -109,6 +117,7 @@ pub struct PersonMentionView { #[skip_serializing_none] #[derive(Debug, PartialEq, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// A comment reply view. pub struct CommentReplyView { @@ -129,6 +138,7 @@ pub struct CommentReplyView { #[derive(Debug, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// A person view. pub struct PersonView { diff --git a/crates/db_views_moderator/src/structs.rs b/crates/db_views_moderator/src/structs.rs index 549b38796..2335e7721 100644 --- a/crates/db_views_moderator/src/structs.rs +++ b/crates/db_views_moderator/src/structs.rs @@ -34,6 +34,7 @@ use ts_rs::TS; #[skip_serializing_none] #[derive(Debug, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// When someone is added as a community moderator. pub struct ModAddCommunityView { @@ -46,6 +47,7 @@ pub struct ModAddCommunityView { #[skip_serializing_none] #[derive(Debug, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// When someone is added as a site moderator. pub struct ModAddView { @@ -57,6 +59,7 @@ pub struct ModAddView { #[skip_serializing_none] #[derive(Debug, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// When someone is banned from a community. pub struct ModBanFromCommunityView { @@ -69,6 +72,7 @@ pub struct ModBanFromCommunityView { #[skip_serializing_none] #[derive(Debug, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// When someone is banned from the site. pub struct ModBanView { @@ -80,6 +84,7 @@ pub struct ModBanView { #[skip_serializing_none] #[derive(Debug, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// When a community is hidden from public view. pub struct ModHideCommunityView { @@ -91,6 +96,7 @@ pub struct ModHideCommunityView { #[skip_serializing_none] #[derive(Debug, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// When a moderator locks a post (prevents new comments being made). pub struct ModLockPostView { @@ -103,6 +109,7 @@ pub struct ModLockPostView { #[skip_serializing_none] #[derive(Debug, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// When a moderator removes a comment. pub struct ModRemoveCommentView { @@ -117,6 +124,7 @@ pub struct ModRemoveCommentView { #[skip_serializing_none] #[derive(Debug, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// When a moderator removes a community. pub struct ModRemoveCommunityView { @@ -128,6 +136,7 @@ pub struct ModRemoveCommunityView { #[skip_serializing_none] #[derive(Debug, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// When a moderator removes a post. pub struct ModRemovePostView { @@ -140,6 +149,7 @@ pub struct ModRemovePostView { #[skip_serializing_none] #[derive(Debug, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// When a moderator features a post on a community (pins it to the top). pub struct ModFeaturePostView { @@ -152,6 +162,7 @@ pub struct ModFeaturePostView { #[skip_serializing_none] #[derive(Debug, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// When a moderator transfers a community to a new owner. pub struct ModTransferCommunityView { @@ -164,6 +175,7 @@ pub struct ModTransferCommunityView { #[skip_serializing_none] #[derive(Debug, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// When an admin purges a comment. pub struct AdminPurgeCommentView { @@ -175,6 +187,7 @@ pub struct AdminPurgeCommentView { #[skip_serializing_none] #[derive(Debug, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// When an admin purges a community. pub struct AdminPurgeCommunityView { @@ -185,6 +198,7 @@ pub struct AdminPurgeCommunityView { #[skip_serializing_none] #[derive(Debug, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// When an admin purges a person. pub struct AdminPurgePersonView { @@ -195,6 +209,7 @@ pub struct AdminPurgePersonView { #[skip_serializing_none] #[derive(Debug, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// When an admin purges a post. pub struct AdminPurgePostView { @@ -206,6 +221,7 @@ pub struct AdminPurgePostView { #[skip_serializing_none] #[derive(Debug, Serialize, Deserialize, Clone, Copy)] #[cfg_attr(feature = "full", derive(TS, Queryable))] +#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] #[cfg_attr(feature = "full", ts(export))] /// Querying / filtering the modlog. pub struct ModlogListParams {