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 } rust_decimal = { version = "1", default-features = false, optional = true }
bigdecimal = { version = "0.3", 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-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 = { version = "0.29.0-rc.2", features = ["thread-safe"] }
sea-query-binder = { version = "0.4.0-rc.1", default-features = false, optional = true } sea-query-binder = { version = "0.4.0-rc.2", default-features = false, optional = true }
strum = { version = "0.24", default-features = false } strum = { version = "0.24", default-features = false }
serde = { version = "1.0", default-features = false } serde = { version = "1.0", default-features = false }
serde_json = { version = "1.0", default-features = false, optional = true } 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 } dotenvy = { version = "0.15", default-features = false, optional = true }
async-std = { version = "1.9", default-features = false, features = ["attributes", "tokio1"], 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-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 } 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-subscriber = { version = "0.3.17", default-features = false, features = ["env-filter", "fmt"] }
tracing = { version = "0.1", default-features = false } tracing = { version = "0.1", default-features = false }

View File

@ -17,7 +17,7 @@ name = "sea_orm_codegen"
path = "src/lib.rs" path = "src/lib.rs"
[dependencies] [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"] } syn = { version = "1", default-features = false, features = ["parsing", "proc-macro", "derive", "printing"] }
quote = { version = "1", default-features = false } quote = { version = "1", default-features = false }
heck = { version = "0.4", default-features = false } heck = { version = "0.4", default-features = false }

View File

@ -178,7 +178,7 @@ impl Column {
} }
ColumnType::Array(column_type) => { ColumnType::Array(column_type) => {
let column_type = write_col_def(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)] #[allow(unreachable_patterns)]
_ => unimplemented!(), _ => unimplemented!(),

View File

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

View File

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

View File

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

View File

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

View File

@ -49,8 +49,8 @@ impl ColumnTrait for Column {
fn def(&self) -> ColumnDef { fn def(&self) -> ColumnDef {
match self { match self {
Self::Id => ColumnType::Integer.def(), Self::Id => ColumnType::Integer.def(),
Self::Floats => ColumnType::Array(sea_orm::sea_query::SeaRc::new(ColumnType::Float)).def(), Self::Floats => ColumnType::Array(RcOrArc::new(ColumnType::Float)).def(),
Self::Doubles => ColumnType::Array(sea_orm::sea_query::SeaRc::new(ColumnType::Double)).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 } dotenvy = { version = "0.15", default-features = false, optional = true }
sea-orm = { version = "0.12.0", path = "../", default-features = false, features = ["macros"] } 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-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 = { version = "0.1", default-features = false, features = ["log"] }
tracing-subscriber = { version = "0.3.17", default-features = false, features = ["env-filter", "fmt"] } tracing-subscriber = { version = "0.3.17", default-features = false, features = ["env-filter", "fmt"] }
futures = { version = "0.3", default-features = false, features = ["std"] } 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. /// > See [DeriveActiveEnum](sea_orm_macros::DeriveActiveEnum) for the full specification of macro attributes.
/// ///
/// ```rust /// ```rust
/// use sea_orm::{ /// use sea_orm::entity::prelude::*;
/// entity::prelude::*,
/// sea_query::{DynIden, SeaRc},
/// };
/// ///
/// // Using the derive macro /// // Using the derive macro
/// #[derive(Debug, PartialEq, EnumIter, DeriveActiveEnum)] /// #[derive(Debug, PartialEq, EnumIter, DeriveActiveEnum)]

View File

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

View File

@ -1,13 +1,13 @@
pub mod common; pub mod common;
use common::{features::*, TestContext}; use common::features::*;
use pretty_assertions::assert_eq; use pretty_assertions::assert_eq;
use sea_orm::{entity::prelude::*, entity::*, DatabaseConnection}; use sea_orm::{entity::prelude::*, entity::*, DatabaseConnection};
#[sea_orm_macros::test] #[sea_orm_macros::test]
#[cfg(feature = "sqlx-postgres")] #[cfg(feature = "sqlx-postgres")]
async fn main() -> Result<(), DbErr> { 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_tables(&ctx.db).await?;
create_and_update(&ctx.db).await?; create_and_update(&ctx.db).await?;
ctx.delete().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::entity::prelude::*;
use sea_orm::{ use sea_orm::{
sea_query::{ArrayType, ColumnType, SeaRc, ValueType}, sea_query::{ArrayType, ColumnType, ValueType},
TryGetError, TryGetable, TryGetError, TryGetable,
}; };
@ -65,6 +65,6 @@ impl ValueType for Events {
} }
fn column_type() -> ColumnType { 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 bits;
pub mod byte_primary_key; pub mod byte_primary_key;
pub mod collection; pub mod collection;
pub mod collection_expanded;
pub mod custom_active_model; pub mod custom_active_model;
pub mod dyn_table_name_lazy_static; pub mod dyn_table_name_lazy_static;
pub mod edit_log; pub mod edit_log;
@ -30,6 +31,7 @@ pub use binary::Entity as Binary;
pub use bits::Entity as Bits; pub use bits::Entity as Bits;
pub use byte_primary_key::Entity as BytePrimaryKey; pub use byte_primary_key::Entity as BytePrimaryKey;
pub use collection::Entity as Collection; 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 dyn_table_name_lazy_static::Entity as DynTableNameLazyStatic;
pub use edit_log::Entity as EditLog; pub use edit_log::Entity as EditLog;
pub use event_trigger::Entity as EventTrigger; pub use event_trigger::Entity as EventTrigger;

View File

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