Bump SeaQuery and SeaSchema to new latest RC version (#1661)

This commit is contained in:
Billy Chan 2023-05-18 16:51:13 +08:00 committed by GitHub
parent b4eecf9cd8
commit 44a94d65d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 98 additions and 33 deletions

View File

@ -34,8 +34,8 @@ tracing = { version = "0.1", default-features = false, features = ["attributes",
rust_decimal = { version = "1", default-features = false, optional = true }
bigdecimal = { version = "0.3", default-features = false, optional = true }
sea-orm-macros = { version = "0.12.0", path = "sea-orm-macros", default-features = false, features = ["strum"] }
sea-query = { version = "0.29.0-rc.1", features = ["thread-safe"] }
sea-query-binder = { version = "0.4.0-rc.1", default-features = false, optional = true }
sea-query = { version = "0.29.0-rc.2", features = ["thread-safe"] }
sea-query-binder = { version = "0.4.0-rc.2", default-features = false, optional = true }
strum = { version = "0.24", default-features = false }
serde = { version = "1.0", default-features = false }
serde_json = { version = "1.0", default-features = false, optional = true }

View File

@ -38,7 +38,7 @@ clap = { version = "3.2", default-features = false, features = ["std", "env", "d
dotenvy = { version = "0.15", default-features = false, optional = true }
async-std = { version = "1.9", default-features = false, features = ["attributes", "tokio1"], optional = true }
sea-orm-codegen = { version = "=0.12.0", path = "../sea-orm-codegen", default-features = false, optional = true }
sea-schema = { version = "0.12.0-rc.1" }
sea-schema = { version = "0.12.0-rc.2" }
sqlx = { version = "0.6", default-features = false, features = ["mysql", "postgres"], optional = true }
tracing-subscriber = { version = "0.3.17", default-features = false, features = ["env-filter", "fmt"] }
tracing = { version = "0.1", default-features = false }

View File

@ -17,7 +17,7 @@ name = "sea_orm_codegen"
path = "src/lib.rs"
[dependencies]
sea-query = { version = "0.29.0-rc.1", default-features = false, features = ["thread-safe"] }
sea-query = { version = "0.29.0-rc.2", default-features = false, features = ["thread-safe"] }
syn = { version = "1", default-features = false, features = ["parsing", "proc-macro", "derive", "printing"] }
quote = { version = "1", default-features = false }
heck = { version = "0.4", default-features = false }

View File

@ -178,7 +178,7 @@ impl Column {
}
ColumnType::Array(column_type) => {
let column_type = write_col_def(column_type);
quote! { ColumnType::Array(sea_orm::sea_query::SeaRc::new(#column_type)) }
quote! { ColumnType::Array(RcOrArc::new(#column_type)) }
}
#[allow(unreachable_patterns)]
_ => unimplemented!(),

View File

@ -785,7 +785,7 @@ mod tests {
};
use pretty_assertions::assert_eq;
use proc_macro2::TokenStream;
use sea_query::{ColumnType, ForeignKeyAction, SeaRc};
use sea_query::{ColumnType, ForeignKeyAction, RcOrArc};
use std::io::{self, BufRead, BufReader, Read};
fn setup() -> Vec<Entity> {
@ -1258,14 +1258,14 @@ mod tests {
},
Column {
name: "integers".to_owned(),
col_type: ColumnType::Array(SeaRc::new(ColumnType::Integer)),
col_type: ColumnType::Array(RcOrArc::new(ColumnType::Integer)),
auto_increment: false,
not_null: true,
unique: false,
},
Column {
name: "integers_opt".to_owned(),
col_type: ColumnType::Array(SeaRc::new(ColumnType::Integer)),
col_type: ColumnType::Array(RcOrArc::new(ColumnType::Integer)),
auto_increment: false,
not_null: false,
unique: false,
@ -1289,14 +1289,14 @@ mod tests {
},
Column {
name: "floats".to_owned(),
col_type: ColumnType::Array(SeaRc::new(ColumnType::Float)),
col_type: ColumnType::Array(RcOrArc::new(ColumnType::Float)),
auto_increment: false,
not_null: true,
unique: false,
},
Column {
name: "doubles".to_owned(),
col_type: ColumnType::Array(SeaRc::new(ColumnType::Double)),
col_type: ColumnType::Array(RcOrArc::new(ColumnType::Double)),
auto_increment: false,
not_null: true,
unique: false,

View File

@ -45,8 +45,8 @@ impl ColumnTrait for Column {
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::Integer.def(),
Self::Integers => ColumnType::Array(sea_orm::sea_query::SeaRc::new(ColumnType::Integer)).def(),
Self::IntegersOpt => ColumnType::Array(sea_orm::sea_query::SeaRc::new(ColumnType::Integer)).def().null(),
Self::Integers => ColumnType::Array(RcOrArc::new(ColumnType::Integer)).def(),
Self::IntegersOpt => ColumnType::Array(RcOrArc::new(ColumnType::Integer)).def().null(),
}
}
}

View File

@ -45,8 +45,8 @@ impl ColumnTrait for Column {
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::Integer.def(),
Self::Floats => ColumnType::Array(sea_orm::sea_query::SeaRc::new(ColumnType::Float)).def(),
Self::Doubles => ColumnType::Array(sea_orm::sea_query::SeaRc::new(ColumnType::Double)).def(),
Self::Floats => ColumnType::Array(RcOrArc::new(ColumnType::Float)).def(),
Self::Doubles => ColumnType::Array(RcOrArc::new(ColumnType::Double)).def(),
}
}
}

View File

@ -49,8 +49,8 @@ impl ColumnTrait for Column {
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::Integer.def(),
Self::Integers => ColumnType::Array(sea_orm::sea_query::SeaRc::new(ColumnType::Integer)).def(),
Self::IntegersOpt => ColumnType::Array(sea_orm::sea_query::SeaRc::new(ColumnType::Integer)).def().null(),
Self::Integers => ColumnType::Array(RcOrArc::new(ColumnType::Integer)).def(),
Self::IntegersOpt => ColumnType::Array(RcOrArc::new(ColumnType::Integer)).def().null(),
}
}
}

View File

@ -49,8 +49,8 @@ impl ColumnTrait for Column {
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::Integer.def(),
Self::Floats => ColumnType::Array(sea_orm::sea_query::SeaRc::new(ColumnType::Float)).def(),
Self::Doubles => ColumnType::Array(sea_orm::sea_query::SeaRc::new(ColumnType::Double)).def(),
Self::Floats => ColumnType::Array(RcOrArc::new(ColumnType::Float)).def(),
Self::Doubles => ColumnType::Array(RcOrArc::new(ColumnType::Double)).def(),
}
}
}

View File

@ -25,7 +25,7 @@ clap = { version = "3.2", default-features = false, features = ["std", "env", "d
dotenvy = { version = "0.15", default-features = false, optional = true }
sea-orm = { version = "0.12.0", path = "../", default-features = false, features = ["macros"] }
sea-orm-cli = { version = "0.12.0", path = "../sea-orm-cli", default-features = false, optional = true }
sea-schema = { version = "0.12.0-rc.1" }
sea-schema = { version = "0.12.0-rc.2" }
tracing = { version = "0.1", default-features = false, features = ["log"] }
tracing-subscriber = { version = "0.3.17", default-features = false, features = ["env-filter", "fmt"] }
futures = { version = "0.3", default-features = false, features = ["std"] }

View File

@ -14,10 +14,7 @@ use sea_query::{DynIden, Expr, Nullable, SimpleExpr, Value, ValueType};
/// > See [DeriveActiveEnum](sea_orm_macros::DeriveActiveEnum) for the full specification of macro attributes.
///
/// ```rust
/// use sea_orm::{
/// entity::prelude::*,
/// sea_query::{DynIden, SeaRc},
/// };
/// use sea_orm::entity::prelude::*;
///
/// // Using the derive macro
/// #[derive(Debug, PartialEq, EnumIter, DeriveActiveEnum)]

View File

@ -1,9 +1,11 @@
pub use crate::{
error::*, sea_query::BlobSize, ActiveEnum, ActiveModelBehavior, ActiveModelTrait, ColumnDef,
ColumnTrait, ColumnType, ColumnTypeTrait, ConnectionTrait, CursorTrait, DatabaseConnection,
DbConn, EntityName, EntityTrait, EnumIter, ForeignKeyAction, Iden, IdenStatic, Linked,
LoaderTrait, ModelTrait, PaginatorTrait, PrimaryKeyToColumn, PrimaryKeyTrait, QueryFilter,
QueryResult, Related, RelationDef, RelationTrait, Select, Value,
error::*,
sea_query::{BlobSize, DynIden, RcOrArc, SeaRc},
ActiveEnum, ActiveModelBehavior, ActiveModelTrait, ColumnDef, ColumnTrait, ColumnType,
ColumnTypeTrait, ConnectionTrait, CursorTrait, DatabaseConnection, DbConn, EntityName,
EntityTrait, EnumIter, ForeignKeyAction, Iden, IdenStatic, Linked, LoaderTrait, ModelTrait,
PaginatorTrait, PrimaryKeyToColumn, PrimaryKeyTrait, QueryFilter, QueryResult, Related,
RelationDef, RelationTrait, Select, Value,
};
#[cfg(feature = "macros")]

View File

@ -1,13 +1,13 @@
pub mod common;
use common::{features::*, TestContext};
use common::features::*;
use pretty_assertions::assert_eq;
use sea_orm::{entity::prelude::*, entity::*, DatabaseConnection};
#[sea_orm_macros::test]
#[cfg(feature = "sqlx-postgres")]
async fn main() -> Result<(), DbErr> {
let ctx = TestContext::new("bits_tests").await;
let ctx = common::TestContext::new("bits_tests").await;
create_tables(&ctx.db).await?;
create_and_update(&ctx.db).await?;
ctx.delete().await;

View File

@ -0,0 +1,64 @@
use sea_orm::entity::prelude::*;
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn schema_name(&self) -> Option<&str> {
Some("schema_name")
}
fn table_name(&self) -> &str {
"collection"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq)]
pub struct Model {
pub id: i32,
pub integers: Vec<i32>,
pub integers_opt: Option<Vec<i32>>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
Integers,
IntegersOpt,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = i32;
fn auto_increment() -> bool {
true
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::Integer.def(),
Self::Integers => ColumnType::Array(RcOrArc::new(ColumnType::Integer)).def(),
Self::IntegersOpt => ColumnType::Array(RcOrArc::new(ColumnType::Integer))
.def()
.null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
panic!("No RelationDef")
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,6 +1,6 @@
use sea_orm::entity::prelude::*;
use sea_orm::{
sea_query::{ArrayType, ColumnType, SeaRc, ValueType},
sea_query::{ArrayType, ColumnType, ValueType},
TryGetError, TryGetable,
};
@ -65,6 +65,6 @@ impl ValueType for Events {
}
fn column_type() -> ColumnType {
ColumnType::Array(SeaRc::new(ColumnType::String(None)))
ColumnType::Array(RcOrArc::new(ColumnType::String(None)))
}
}

View File

@ -5,6 +5,7 @@ pub mod binary;
pub mod bits;
pub mod byte_primary_key;
pub mod collection;
pub mod collection_expanded;
pub mod custom_active_model;
pub mod dyn_table_name_lazy_static;
pub mod edit_log;
@ -30,6 +31,7 @@ pub use binary::Entity as Binary;
pub use bits::Entity as Bits;
pub use byte_primary_key::Entity as BytePrimaryKey;
pub use collection::Entity as Collection;
pub use collection_expanded::Entity as CollectionExpanded;
pub use dyn_table_name_lazy_static::Entity as DynTableNameLazyStatic;
pub use edit_log::Entity as EditLog;
pub use event_trigger::Entity as EventTrigger;

View File

@ -6,7 +6,7 @@ use sea_orm::{
entity::prelude::*, DatabaseConnection, Delete, IntoActiveModel, Iterable, QueryTrait, Set,
Update,
};
use sea_query::{Expr, IntoIden, Query};
use sea_query::{Expr, Query};
#[sea_orm_macros::test]
#[cfg(any(