mirror of
https://github.com/chatmail/core.git
synced 2026-05-19 23:06:32 +03:00
fix compilation
This commit is contained in:
@@ -15,14 +15,14 @@ pub fn sqlx_derive(input: TokenStream) -> TokenStream {
|
|||||||
|
|
||||||
let gen = quote! {
|
let gen = quote! {
|
||||||
impl<'q> sqlx::encode::Encode<'q, sqlx::sqlite::Sqlite> for #name {
|
impl<'q> sqlx::encode::Encode<'q, sqlx::sqlite::Sqlite> for #name {
|
||||||
fn encode_by_ref(&self, buf: &mut Vec<sqlx::sqlite::SqliteArgumentValue<'q>>) -> sqlx::encode::IsNull{
|
fn encode_by_ref(&self, buf: &mut Vec<sqlx::sqlite::SqliteArgumentValue<'q>>) -> sqlx::encode::IsNull {
|
||||||
num_traits::ToPrimitive::to_i32(self).expect("invalid type").encode(buf)
|
num_traits::ToPrimitive::to_i32(self).expect("invalid type").encode(buf)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl<'de> sqlx::decode::Decode<'de, sqlx::sqlite::Sqlite> for #name {
|
impl<'de> sqlx::decode::Decode<'de, sqlx::sqlite::Sqlite> for #name {
|
||||||
fn decode(value: sqlx::sqlite::SqliteValueRef) -> std::result::Result<Self, sqlx::BoxDynError> {
|
fn decode(value: sqlx::sqlite::SqliteValueRef) -> std::result::Result<Self, Box<dyn std::error::Error + 'static + Send + Sync>> {
|
||||||
let raw: i32 = sqlx::decode::Decode::decode(value)?;
|
let raw: i32 = sqlx::decode::Decode::decode(value)?;
|
||||||
|
|
||||||
Ok(num_traits::FromPrimitive::from_i32(raw).unwrap_or_default())
|
Ok(num_traits::FromPrimitive::from_i32(raw).unwrap_or_default())
|
||||||
|
|||||||
@@ -2172,7 +2172,7 @@ impl sqlx::encode::Encode<'_, sqlx::sqlite::Sqlite> for MuteDuration {
|
|||||||
impl<'de> sqlx::decode::Decode<'de, sqlx::sqlite::Sqlite> for MuteDuration {
|
impl<'de> sqlx::decode::Decode<'de, sqlx::sqlite::Sqlite> for MuteDuration {
|
||||||
fn decode(
|
fn decode(
|
||||||
value: sqlx::sqlite::SqliteValueRef,
|
value: sqlx::sqlite::SqliteValueRef,
|
||||||
) -> std::result::Result<Self, sqlx::error::BoxDynError> {
|
) -> std::result::Result<Self, Box<dyn std::error::Error + 'static + Send + Sync>> {
|
||||||
// Negative values other than -1 should not be in the
|
// Negative values other than -1 should not be in the
|
||||||
// database. If found they'll be NotMuted.
|
// database. If found they'll be NotMuted.
|
||||||
let raw: i32 = sqlx::decode::Decode::decode(value)?;
|
let raw: i32 = sqlx::decode::Decode::decode(value)?;
|
||||||
|
|||||||
@@ -364,14 +364,15 @@ ALTER TABLE chats ADD COLUMN muted_until INTEGER DEFAULT 0;
|
|||||||
UPDATE chats SET grpid='' WHERE type=100;
|
UPDATE chats SET grpid='' WHERE type=100;
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
migrate(
|
migrate(
|
||||||
64,
|
64,
|
||||||
r#"
|
r#"
|
||||||
ALTER TABLE msgs ADD COLUMN error TEXT DEFAULT '';
|
ALTER TABLE msgs ADD COLUMN error TEXT DEFAULT '';
|
||||||
"#,
|
"#,
|
||||||
).await?;
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user