]> Untitled Git - lemmy.git/blobdiff - crates/db_schema/src/newtypes.rs
Diesel 2.0.0 upgrade (#2452)
[lemmy.git] / crates / db_schema / src / newtypes.rs
index 1e0ecf2b8066af126fc13ddfa98a2bc731d5b312..5d23b12a88f842d83cfd6257fc67e67ca01dc8d3 100644 (file)
@@ -1,3 +1,4 @@
+use diesel_ltree::Ltree;
 use serde::{Deserialize, Serialize};
 use std::{
   fmt,
@@ -68,12 +69,33 @@ pub struct CommentReportId(i32);
 #[cfg_attr(feature = "full", derive(DieselNewType))]
 pub struct PostReportId(i32);
 
+#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
+#[cfg_attr(feature = "full", derive(DieselNewType))]
+pub struct PrivateMessageReportId(i32);
+
+#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
+#[cfg_attr(feature = "full", derive(DieselNewType))]
+pub struct LanguageId(pub i32);
+
+#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
+#[cfg_attr(feature = "full", derive(DieselNewType))]
+pub struct LocalUserLanguageId(pub i32);
+
+#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
+#[cfg_attr(feature = "full", derive(DieselNewType))]
+pub struct CommentReplyId(i32);
+
 #[repr(transparent)]
-#[derive(Clone, PartialEq, Serialize, Deserialize, Debug)]
+#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
 #[cfg_attr(feature = "full", derive(AsExpression, FromSqlRow))]
-#[cfg_attr(feature = "full", sql_type = "diesel::sql_types::Text")]
+#[cfg_attr(feature = "full", diesel(sql_type = diesel::sql_types::Text))]
 pub struct DbUrl(pub(crate) Url);
 
+#[derive(Serialize, Deserialize)]
+#[serde(remote = "Ltree")]
+/// Do remote derivation for the Ltree struct
+pub struct LtreeDef(pub String);
+
 impl Display for DbUrl {
   fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
     self.to_owned().0.fmt(f)