Merge pull request #370 from SeaQL/bump-query-dep-to-pr-202
This commit is contained in:
commit
9ef44be422
@ -30,7 +30,7 @@ futures-util = { version = "^0.3" }
|
||||
tracing = "0.1"
|
||||
rust_decimal = { version = "^1", optional = true }
|
||||
sea-orm-macros = { version = "^0.4.2", path = "sea-orm-macros", optional = true }
|
||||
sea-query = { version = "^0.19.4", features = ["thread-safe"] }
|
||||
sea-query = { version = "^0.20.0", features = ["thread-safe"] }
|
||||
sea-strum = { version = "^0.21", features = ["derive", "sea-orm"] }
|
||||
serde = { version = "^1.0", features = ["derive"] }
|
||||
serde_json = { version = "^1", optional = true }
|
||||
|
@ -465,10 +465,12 @@ pub(crate) fn join_tbl_on_condition(
|
||||
|
||||
pub(crate) fn unpack_table_ref(table_ref: &TableRef) -> DynIden {
|
||||
match table_ref {
|
||||
TableRef::Table(tbl) => SeaRc::clone(tbl),
|
||||
TableRef::SchemaTable(_, tbl) => SeaRc::clone(tbl),
|
||||
TableRef::TableAlias(tbl, _) => SeaRc::clone(tbl),
|
||||
TableRef::SchemaTableAlias(_, tbl, _) => SeaRc::clone(tbl),
|
||||
TableRef::SubQuery(_, tbl) => SeaRc::clone(tbl),
|
||||
TableRef::Table(tbl)
|
||||
| TableRef::SchemaTable(_, tbl)
|
||||
| TableRef::DatabaseSchemaTable(_, _, tbl)
|
||||
| TableRef::TableAlias(tbl, _)
|
||||
| TableRef::SchemaTableAlias(_, tbl, _)
|
||||
| TableRef::DatabaseSchemaTableAlias(_, _, tbl, _)
|
||||
| TableRef::SubQuery(_, tbl) => SeaRc::clone(tbl),
|
||||
}
|
||||
}
|
||||
|
@ -184,17 +184,6 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_create_table_from_entity() {
|
||||
for builder in [DbBackend::MySql, DbBackend::Sqlite] {
|
||||
let schema = Schema::new(builder);
|
||||
assert_eq!(
|
||||
builder.build(&schema.create_table_from_entity(CakeFillingPrice)),
|
||||
builder.build(&get_stmt().table(CakeFillingPrice).to_owned())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
fn get_stmt() -> TableCreateStatement {
|
||||
Table::create()
|
||||
.col(
|
||||
|
@ -402,6 +402,8 @@ mod tests {
|
||||
tea: None,
|
||||
};
|
||||
let select = active_enum_model.find_related(ActiveEnumChild);
|
||||
#[cfg(any(feature = "sqlx-mysql", feature = "sqlx-sqlite"))]
|
||||
{
|
||||
assert_eq!(
|
||||
select.build(DbBackend::MySql).to_string(),
|
||||
select.build(DbBackend::Sqlite).to_string(),
|
||||
@ -416,6 +418,8 @@ mod tests {
|
||||
]
|
||||
.join(" ")
|
||||
);
|
||||
}
|
||||
#[cfg(feature = "sqlx-postgres")]
|
||||
assert_eq!(
|
||||
select.build(DbBackend::Postgres).to_string(),
|
||||
[
|
||||
@ -428,6 +432,8 @@ mod tests {
|
||||
);
|
||||
|
||||
let select = ActiveEnum::find().find_also_related(ActiveEnumChild);
|
||||
#[cfg(any(feature = "sqlx-mysql", feature = "sqlx-sqlite"))]
|
||||
{
|
||||
assert_eq!(
|
||||
select.build(DbBackend::MySql).to_string(),
|
||||
select.build(DbBackend::Sqlite).to_string(),
|
||||
@ -444,6 +450,8 @@ mod tests {
|
||||
]
|
||||
.join(" ")
|
||||
);
|
||||
}
|
||||
#[cfg(feature = "sqlx-postgres")]
|
||||
assert_eq!(
|
||||
select
|
||||
.build(DbBackend::Postgres)
|
||||
@ -467,6 +475,8 @@ mod tests {
|
||||
tea: None,
|
||||
};
|
||||
let select = active_enum_model.find_linked(active_enum::ActiveEnumChildLink);
|
||||
#[cfg(any(feature = "sqlx-mysql", feature = "sqlx-sqlite"))]
|
||||
{
|
||||
assert_eq!(
|
||||
select.build(DbBackend::MySql).to_string(),
|
||||
select.build(DbBackend::Sqlite).to_string(),
|
||||
@ -481,6 +491,8 @@ mod tests {
|
||||
]
|
||||
.join(" ")
|
||||
);
|
||||
}
|
||||
#[cfg(feature = "sqlx-postgres")]
|
||||
assert_eq!(
|
||||
select.build(DbBackend::Postgres).to_string(),
|
||||
[
|
||||
@ -493,6 +505,8 @@ mod tests {
|
||||
);
|
||||
|
||||
let select = ActiveEnum::find().find_also_linked(active_enum::ActiveEnumChildLink);
|
||||
#[cfg(any(feature = "sqlx-mysql", feature = "sqlx-sqlite"))]
|
||||
{
|
||||
assert_eq!(
|
||||
select.build(DbBackend::MySql).to_string(),
|
||||
select.build(DbBackend::Sqlite).to_string(),
|
||||
@ -509,6 +523,8 @@ mod tests {
|
||||
]
|
||||
.join(" ")
|
||||
);
|
||||
}
|
||||
#[cfg(feature = "sqlx-postgres")]
|
||||
assert_eq!(
|
||||
select
|
||||
.build(DbBackend::Postgres)
|
||||
@ -533,6 +549,8 @@ mod tests {
|
||||
tea: None,
|
||||
};
|
||||
let select = active_enum_child_model.find_related(ActiveEnum);
|
||||
#[cfg(any(feature = "sqlx-mysql", feature = "sqlx-sqlite"))]
|
||||
{
|
||||
assert_eq!(
|
||||
select.build(DbBackend::MySql).to_string(),
|
||||
select.build(DbBackend::Sqlite).to_string(),
|
||||
@ -547,6 +565,8 @@ mod tests {
|
||||
]
|
||||
.join(" ")
|
||||
);
|
||||
}
|
||||
#[cfg(feature = "sqlx-postgres")]
|
||||
assert_eq!(
|
||||
select.build(DbBackend::Postgres).to_string(),
|
||||
[
|
||||
@ -559,6 +579,8 @@ mod tests {
|
||||
);
|
||||
|
||||
let select = ActiveEnumChild::find().find_also_related(ActiveEnum);
|
||||
#[cfg(any(feature = "sqlx-mysql", feature = "sqlx-sqlite"))]
|
||||
{
|
||||
assert_eq!(
|
||||
select.build(DbBackend::MySql).to_string(),
|
||||
select.build(DbBackend::Sqlite).to_string(),
|
||||
@ -575,6 +597,8 @@ mod tests {
|
||||
]
|
||||
.join(" ")
|
||||
);
|
||||
}
|
||||
#[cfg(feature = "sqlx-postgres")]
|
||||
assert_eq!(
|
||||
select
|
||||
.build(DbBackend::Postgres)
|
||||
@ -599,6 +623,8 @@ mod tests {
|
||||
tea: None,
|
||||
};
|
||||
let select = active_enum_child_model.find_linked(active_enum_child::ActiveEnumLink);
|
||||
#[cfg(any(feature = "sqlx-mysql", feature = "sqlx-sqlite"))]
|
||||
{
|
||||
assert_eq!(
|
||||
select.build(DbBackend::MySql).to_string(),
|
||||
select.build(DbBackend::Sqlite).to_string(),
|
||||
@ -613,6 +639,8 @@ mod tests {
|
||||
]
|
||||
.join(" ")
|
||||
);
|
||||
}
|
||||
#[cfg(feature = "sqlx-postgres")]
|
||||
assert_eq!(
|
||||
select.build(DbBackend::Postgres).to_string(),
|
||||
[
|
||||
@ -625,6 +653,8 @@ mod tests {
|
||||
);
|
||||
|
||||
let select = ActiveEnumChild::find().find_also_linked(active_enum_child::ActiveEnumLink);
|
||||
#[cfg(any(feature = "sqlx-mysql", feature = "sqlx-sqlite"))]
|
||||
{
|
||||
assert_eq!(
|
||||
select.build(DbBackend::MySql).to_string(),
|
||||
select.build(DbBackend::Sqlite).to_string(),
|
||||
@ -641,6 +671,8 @@ mod tests {
|
||||
]
|
||||
.join(" ")
|
||||
);
|
||||
}
|
||||
#[cfg(feature = "sqlx-postgres")]
|
||||
assert_eq!(
|
||||
select
|
||||
.build(DbBackend::Postgres)
|
||||
|
@ -2,7 +2,8 @@ use super::sea_orm_active_enums::*;
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
|
||||
#[sea_orm(schema_name = "public", table_name = "active_enum")]
|
||||
#[cfg_attr(feature = "sqlx-postgres", sea_orm(schema_name = "public"))]
|
||||
#[sea_orm(table_name = "active_enum")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
pub id: i32,
|
||||
|
@ -2,7 +2,8 @@ use super::sea_orm_active_enums::*;
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
|
||||
#[sea_orm(schema_name = "public", table_name = "active_enum_child")]
|
||||
#[cfg_attr(feature = "sqlx-postgres", sea_orm(schema_name = "public"))]
|
||||
#[sea_orm(table_name = "active_enum_child")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
pub id: i32,
|
||||
|
Loading…
x
Reference in New Issue
Block a user