dependencies: Upgrade sea-orm to 1.1.8

This commit is contained in:
Valentin Tolmer
2025-03-30 21:35:13 +02:00
committed by nitnelave
parent 26b25e7776
commit e4044b7415
9 changed files with 262 additions and 188 deletions

381
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -23,3 +23,7 @@ opt-level = 's'
[patch.crates-io.lber]
git = 'https://github.com/inejge/ldap3/'
[workspace.dependencies.sea-orm]
version = "1.1.8"
default-features = false

View File

@@ -39,8 +39,7 @@ version = "*"
features = ["serde"]
[dependencies.sea-orm]
version = "0.12"
default-features = false
workspace = true
features = ["macros"]
optional = true

View File

@@ -35,8 +35,7 @@ features = ["opaque_server", "opaque_client", "sea_orm"]
path = "../domain"
[dependencies.sea-orm]
version = "0.12"
default-features = false
workspace = true
features = [
"macros",
"with-chrono",

View File

@@ -1,6 +1,6 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.10.3
use sea_orm::{entity::prelude::*, sea_query::BlobSize};
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
use lldap_domain::types::{Email, UserId, Uuid};
@@ -47,15 +47,15 @@ impl ColumnTrait for Column {
fn def(&self) -> ColumnDef {
match self {
Column::UserId => ColumnType::String(Some(255)),
Column::Email => ColumnType::String(Some(255)),
Column::LowercaseEmail => ColumnType::String(Some(255)),
Column::DisplayName => ColumnType::String(Some(255)),
Column::UserId => ColumnType::String(StringLen::N(255)),
Column::Email => ColumnType::String(StringLen::N(255)),
Column::LowercaseEmail => ColumnType::String(StringLen::N(255)),
Column::DisplayName => ColumnType::String(StringLen::N(255)),
Column::CreationDate => ColumnType::DateTime,
Column::PasswordHash => ColumnType::Binary(BlobSize::Medium),
Column::TotpSecret => ColumnType::String(Some(64)),
Column::MfaType => ColumnType::String(Some(64)),
Column::Uuid => ColumnType::String(Some(36)),
Column::PasswordHash => ColumnType::Blob,
Column::TotpSecret => ColumnType::String(StringLen::N(64)),
Column::MfaType => ColumnType::String(StringLen::N(64)),
Column::Uuid => ColumnType::String(StringLen::N(36)),
}
.def()
}

View File

@@ -40,8 +40,7 @@ path = "../auth"
features = ["opaque_server", "opaque_client", "sea_orm"]
[dependencies.sea-orm]
version = "0.12"
default-features = false
workspace = true
features = [
"macros",
"with-chrono",

View File

@@ -5,7 +5,10 @@ use chrono::{NaiveDateTime, TimeZone};
use lldap_auth::types::CaseInsensitiveString;
use sea_orm::{
entity::IntoActiveValue,
sea_query::{value::ValueType, ArrayType, BlobSize, ColumnType, Nullable, ValueTypeErr},
sea_query::{
extension::mysql::MySqlType, value::ValueType, ArrayType, ColumnType, Nullable, SeaRc,
StringLen, ValueTypeErr,
},
DbErr, DeriveValueType, QueryResult, TryFromU64, TryGetError, TryGetable, Value,
};
use serde::{Deserialize, Serialize};
@@ -26,7 +29,7 @@ pub use lldap_auth::types::UserId;
derive_more::Display,
)]
#[serde(try_from = "&str")]
#[sea_orm(column_type = "String(Some(36))")]
#[sea_orm(column_type = "String(StringLen::N(36))")]
#[debug(r#""{_0}""#)]
#[display("{_0}")]
pub struct Uuid(String);
@@ -74,7 +77,10 @@ macro_rules! uuid {
}
#[derive(Clone, PartialEq, Eq, Hash, Serialize, Deserialize, DeriveValueType)]
#[sea_orm(column_type = "Binary(BlobSize::Long)", array_type = "Bytes")]
#[sea_orm(
column_type = "Custom(SeaRc::new(MySqlType::LongBlob))",
array_type = "Bytes"
)]
pub struct Serialized(Vec<u8>);
const SERIALIZED_I64_LEN: usize = 8;
@@ -308,7 +314,10 @@ impl AsRef<GroupName> for GroupName {
}
#[derive(PartialEq, Eq, Clone, Serialize, Deserialize, DeriveValueType, Hash)]
#[sea_orm(column_type = "Binary(BlobSize::Long)", array_type = "Bytes")]
#[sea_orm(
column_type = "Custom(SeaRc::new(MySqlType::LongBlob))",
array_type = "Bytes"
)]
pub struct JpegPhoto(#[serde(with = "serde_bytes")] Vec<u8>);
impl From<&JpegPhoto> for Value {
@@ -633,7 +642,7 @@ impl ValueType for AttributeType {
}
fn column_type() -> ColumnType {
ColumnType::String(Some(64))
ColumnType::String(StringLen::N(64))
}
}

View File

@@ -132,8 +132,7 @@ features = ["default", "rustls"]
version = "3"
[dependencies.sea-orm]
version = "0.12"
default-features = false
workspace = true
features = [
"macros",
"with-chrono",

View File

@@ -3,8 +3,8 @@ use itertools::Itertools;
use lldap_domain::types::{AttributeType, GroupId, JpegPhoto, Serialized, UserId, Uuid};
use sea_orm::{
sea_query::{
self, all, BinOper, BlobSize::Blob, ColumnDef, Expr, ForeignKey, ForeignKeyAction, Func,
Index, Query, SimpleExpr, Table, Value,
all, BinOper, ColumnDef, Expr, ForeignKey, ForeignKeyAction, Func, Index, Query,
SimpleExpr, Table, Value,
},
ConnectionTrait, DatabaseTransaction, DbErr, DeriveIden, FromQueryResult, Iden, Order,
Statement, TransactionTrait,
@@ -163,7 +163,7 @@ pub async fn upgrade_to_v1(pool: &DbConnection) -> std::result::Result<(), sea_o
.col(ColumnDef::new(Users::LastName).string_len(255))
.col(ColumnDef::new(Users::Avatar).binary())
.col(ColumnDef::new(Users::CreationDate).date_time().not_null())
.col(ColumnDef::new(Users::PasswordHash).binary())
.col(ColumnDef::new(Users::PasswordHash).blob())
.col(ColumnDef::new(Users::TotpSecret).string_len(64))
.col(ColumnDef::new(Users::MfaType).string_len(64))
.col(ColumnDef::new(Users::Uuid).string_len(36).not_null()),
@@ -502,9 +502,7 @@ async fn migrate_to_v3(transaction: DatabaseTransaction) -> Result<DatabaseTrans
transaction,
Users::Table,
Users::Avatar,
ColumnDef::new(Users::Avatar)
.blob(sea_query::BlobSize::Long)
.to_owned(),
ColumnDef::new(Users::Avatar).blob().to_owned(),
[],
)
.await?;
@@ -703,7 +701,7 @@ async fn migrate_to_v5(transaction: DatabaseTransaction) -> Result<DatabaseTrans
)
.col(
ColumnDef::new(UserAttributes::UserAttributeValue)
.blob(sea_query::BlobSize::Long)
.blob()
.not_null(),
)
.foreign_key(
@@ -751,7 +749,7 @@ async fn migrate_to_v5(transaction: DatabaseTransaction) -> Result<DatabaseTrans
)
.col(
ColumnDef::new(GroupAttributes::GroupAttributeValue)
.blob(sea_query::BlobSize::Long)
.blob()
.not_null(),
)
.foreign_key(
@@ -948,7 +946,7 @@ async fn migrate_to_v7(transaction: DatabaseTransaction) -> Result<DatabaseTrans
builder.build(
Table::alter()
.table(Metadata::Table)
.add_column(ColumnDef::new(Metadata::PrivateKeyHash).blob(Blob(Some(32)))),
.add_column(ColumnDef::new(Metadata::PrivateKeyHash).blob()),
),
)
.await?;