server: upgrade sea-orm to 0.11
This commit is contained in:
committed by
nitnelave
parent
96eb17a963
commit
63cbf30dd7
@@ -1,6 +1,6 @@
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.10.3
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use sea_orm::{entity::prelude::*, sea_query::BlobSize};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::domain::types::{JpegPhoto, UserId, Uuid};
|
||||
@@ -56,9 +56,9 @@ impl ColumnTrait for Column {
|
||||
Column::DisplayName => ColumnType::String(Some(255)),
|
||||
Column::FirstName => ColumnType::String(Some(255)),
|
||||
Column::LastName => ColumnType::String(Some(255)),
|
||||
Column::Avatar => ColumnType::Binary,
|
||||
Column::Avatar => ColumnType::Binary(BlobSize::Long),
|
||||
Column::CreationDate => ColumnType::DateTime,
|
||||
Column::PasswordHash => ColumnType::Binary,
|
||||
Column::PasswordHash => ColumnType::Binary(BlobSize::Medium),
|
||||
Column::TotpSecret => ColumnType::String(Some(64)),
|
||||
Column::MfaType => ColumnType::String(Some(64)),
|
||||
Column::Uuid => ColumnType::String(Some(36)),
|
||||
|
||||
@@ -7,10 +7,10 @@ use crate::domain::{
|
||||
};
|
||||
use async_trait::async_trait;
|
||||
use sea_orm::{
|
||||
sea_query::{Cond, IntoCondition, SimpleExpr},
|
||||
ActiveModelTrait, ActiveValue, ColumnTrait, EntityTrait, QueryFilter, QueryOrder, QuerySelect,
|
||||
QueryTrait,
|
||||
};
|
||||
use sea_query::{Cond, IntoCondition, SimpleExpr};
|
||||
use tracing::{debug, instrument};
|
||||
|
||||
fn get_group_filter_expr(filter: GroupRequestFilter) -> Cond {
|
||||
|
||||
@@ -2,8 +2,10 @@ use crate::domain::{
|
||||
sql_tables::{DbConnection, SchemaVersion},
|
||||
types::{GroupId, UserId, Uuid},
|
||||
};
|
||||
use sea_orm::{ConnectionTrait, FromQueryResult, Statement, TransactionTrait};
|
||||
use sea_query::{ColumnDef, Expr, ForeignKey, ForeignKeyAction, Iden, Query, Table, Value};
|
||||
use sea_orm::{
|
||||
sea_query::{self, ColumnDef, Expr, ForeignKey, ForeignKeyAction, Query, Table, Value},
|
||||
ConnectionTrait, FromQueryResult, Iden, Statement, TransactionTrait,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tracing::{info, instrument, warn};
|
||||
|
||||
|
||||
@@ -7,12 +7,11 @@ pub type DbConnection = sea_orm::DatabaseConnection;
|
||||
pub struct SchemaVersion(pub i16);
|
||||
|
||||
impl sea_orm::TryGetable for SchemaVersion {
|
||||
fn try_get(
|
||||
fn try_get_by<I: sea_orm::ColIdx>(
|
||||
res: &sea_orm::QueryResult,
|
||||
pre: &str,
|
||||
col: &str,
|
||||
index: I,
|
||||
) -> Result<Self, sea_orm::TryGetError> {
|
||||
Ok(SchemaVersion(i16::try_get(res, pre, col)?))
|
||||
Ok(SchemaVersion(i16::try_get_by(res, index)?))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,11 +8,10 @@ use super::{
|
||||
use async_trait::async_trait;
|
||||
use sea_orm::{
|
||||
entity::IntoActiveValue,
|
||||
sea_query::{Cond, Expr, IntoCondition, SimpleExpr},
|
||||
sea_query::{Alias, Cond, Expr, IntoColumnRef, IntoCondition, SimpleExpr},
|
||||
ActiveModelTrait, ActiveValue, ColumnTrait, EntityTrait, ModelTrait, QueryFilter, QueryOrder,
|
||||
QuerySelect, QueryTrait, Set,
|
||||
};
|
||||
use sea_query::{Alias, IntoColumnRef};
|
||||
use std::collections::HashSet;
|
||||
use tracing::{debug, instrument};
|
||||
|
||||
|
||||
@@ -53,8 +53,11 @@ impl std::string::ToString for Uuid {
|
||||
}
|
||||
|
||||
impl TryGetable for Uuid {
|
||||
fn try_get(res: &QueryResult, pre: &str, col: &str) -> std::result::Result<Self, TryGetError> {
|
||||
Ok(Uuid(String::try_get(res, pre, col)?))
|
||||
fn try_get_by<I: sea_orm::ColIdx>(
|
||||
res: &QueryResult,
|
||||
index: I,
|
||||
) -> std::result::Result<Self, TryGetError> {
|
||||
Ok(Uuid(String::try_get_by(res, index)?))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,8 +145,8 @@ impl From<&UserId> for Value {
|
||||
}
|
||||
|
||||
impl TryGetable for UserId {
|
||||
fn try_get(res: &QueryResult, pre: &str, col: &str) -> Result<Self, TryGetError> {
|
||||
Ok(UserId::new(&String::try_get(res, pre, col)?))
|
||||
fn try_get_by<I: sea_orm::ColIdx>(res: &QueryResult, index: I) -> Result<Self, TryGetError> {
|
||||
Ok(UserId::new(&String::try_get_by(res, index)?))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,8 +264,8 @@ impl JpegPhoto {
|
||||
}
|
||||
|
||||
impl TryGetable for JpegPhoto {
|
||||
fn try_get(res: &QueryResult, pre: &str, col: &str) -> Result<Self, TryGetError> {
|
||||
<Self as std::convert::TryFrom<Vec<_>>>::try_from(Vec::<u8>::try_get(res, pre, col)?)
|
||||
fn try_get_by<I: sea_orm::ColIdx>(res: &QueryResult, index: I) -> Result<Self, TryGetError> {
|
||||
<Self as std::convert::TryFrom<Vec<_>>>::try_from(Vec::<u8>::try_get_by(res, index)?)
|
||||
.map_err(|e| {
|
||||
TryGetError::DbErr(DbErr::TryIntoErr {
|
||||
from: "[u8]",
|
||||
@@ -345,8 +348,8 @@ impl From<GroupId> for Value {
|
||||
}
|
||||
|
||||
impl TryGetable for GroupId {
|
||||
fn try_get(res: &QueryResult, pre: &str, col: &str) -> Result<Self, TryGetError> {
|
||||
Ok(GroupId(i32::try_get(res, pre, col)?))
|
||||
fn try_get_by<I: sea_orm::ColIdx>(res: &QueryResult, index: I) -> Result<Self, TryGetError> {
|
||||
Ok(GroupId(i32::try_get_by(res, index)?))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -364,7 +367,7 @@ impl ValueType for GroupId {
|
||||
}
|
||||
|
||||
fn column_type() -> ColumnType {
|
||||
ColumnType::Integer(None)
|
||||
ColumnType::Integer
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
use sea_orm::ConnectionTrait;
|
||||
use sea_query::{ColumnDef, ForeignKey, ForeignKeyAction, Iden, Table};
|
||||
use sea_orm::{
|
||||
sea_query::{self, ColumnDef, ForeignKey, ForeignKeyAction, Iden, Table},
|
||||
ConnectionTrait,
|
||||
};
|
||||
|
||||
pub use crate::domain::{sql_migrations::Users, sql_tables::DbConnection};
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@ use crate::domain::{
|
||||
};
|
||||
use async_trait::async_trait;
|
||||
use sea_orm::{
|
||||
sea_query::Cond, ActiveModelTrait, ColumnTrait, EntityTrait, FromQueryResult, IntoActiveModel,
|
||||
QueryFilter, QuerySelect,
|
||||
sea_query::{Cond, Expr},
|
||||
ActiveModelTrait, ColumnTrait, EntityTrait, FromQueryResult, IntoActiveModel, QueryFilter,
|
||||
QuerySelect,
|
||||
};
|
||||
use sea_query::Expr;
|
||||
use std::collections::HashSet;
|
||||
use tracing::{debug, instrument};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user