Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ tracing = { version = "0.1", default-features = false, features = ["attributes",
rust_decimal = { version = "1", default-features = false, optional = true }
bigdecimal = { version = "0.4", default-features = false, optional = true }
sea-orm-macros = { version = "~1.1.10", path = "sea-orm-macros", default-features = false, features = ["strum"] }
sea-query = { version = "0.32.1", default-features = false, features = ["thread-safe", "hashable-value", "backend-mysql", "backend-postgres", "backend-sqlite"] }
sea-query = { version = "0.32.4", default-features = false, features = ["thread-safe", "hashable-value", "backend-mysql", "backend-postgres", "backend-sqlite"] }
sea-query-binder = { version = "0.7.0", default-features = false, optional = true }
strum = { version = "0.26", default-features = false }
serde = { version = "1.0", default-features = false }
Expand Down
4 changes: 2 additions & 2 deletions src/query/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub trait QuerySelect: Sized {
/// .column(lunch_set::Column::Tea)
/// .build(DbBackend::Postgres)
/// .to_string(),
/// r#"SELECT CAST("lunch_set"."tea" AS text) FROM "lunch_set""#
/// r#"SELECT CAST("lunch_set"."tea" AS "text") FROM "lunch_set""#
/// );
/// assert_eq!(
/// lunch_set::Entity::find()
Expand Down Expand Up @@ -141,7 +141,7 @@ pub trait QuerySelect: Sized {
/// .columns([lunch_set::Column::Name, lunch_set::Column::Tea])
/// .build(DbBackend::Postgres)
/// .to_string(),
/// r#"SELECT "lunch_set"."name", CAST("lunch_set"."tea" AS text) FROM "lunch_set""#
/// r#"SELECT "lunch_set"."name", CAST("lunch_set"."tea" AS "text") FROM "lunch_set""#
/// );
/// assert_eq!(
/// lunch_set::Entity::find()
Expand Down
4 changes: 2 additions & 2 deletions src/query/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ mod tests {
.filter(lunch_set::Column::Tea.eq(Tea::BreakfastTea))
.build(DbBackend::Postgres)
.to_string(),
r#"UPDATE "lunch_set" SET "tea" = CAST('EverydayTea' AS tea) WHERE "lunch_set"."tea" = (CAST('BreakfastTea' AS tea))"#,
r#"UPDATE "lunch_set" SET "tea" = CAST('EverydayTea' AS "tea") WHERE "lunch_set"."tea" = (CAST('BreakfastTea' AS "tea"))"#,
);
}

Expand All @@ -325,7 +325,7 @@ mod tests {
})
.build(DbBackend::Postgres)
.to_string(),
r#"UPDATE "lunch_set" SET "tea" = CAST('EverydayTea' AS tea) WHERE "lunch_set"."id" = 1"#,
r#"UPDATE "lunch_set" SET "tea" = CAST('EverydayTea' AS "tea") WHERE "lunch_set"."id" = 1"#,
);
}
}
32 changes: 16 additions & 16 deletions tests/active_enum_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ pub async fn insert_active_enum(db: &DatabaseConnection) -> Result<(), DbErr> {
r#"SELECT "active_enum"."id","#,
r#""active_enum"."category","#,
r#""active_enum"."color","#,
r#"CAST("active_enum"."tea" AS text)"#,
r#"CAST("active_enum"."tea" AS "text")"#,
r#"FROM "public"."active_enum""#,
r#"WHERE "active_enum"."tea" IN (CAST('EverydayTea' AS tea), CAST('BreakfastTea' AS tea))"#,
r#"WHERE "active_enum"."tea" IN (CAST('EverydayTea' AS "tea"), CAST('BreakfastTea' AS "tea"))"#,
]
.join(" ")
);
Expand Down Expand Up @@ -195,10 +195,10 @@ pub async fn insert_active_enum(db: &DatabaseConnection) -> Result<(), DbErr> {
r#"SELECT "active_enum"."id","#,
r#""active_enum"."category","#,
r#""active_enum"."color","#,
r#"CAST("active_enum"."tea" AS text)"#,
r#"CAST("active_enum"."tea" AS "text")"#,
r#"FROM "public"."active_enum""#,
r#"WHERE "active_enum"."tea" IS NOT NULL"#,
r#"AND "active_enum"."tea" NOT IN (CAST('BreakfastTea' AS tea))"#,
r#"AND "active_enum"."tea" NOT IN (CAST('BreakfastTea' AS "tea"))"#,
]
.join(" ")
);
Expand Down Expand Up @@ -704,7 +704,7 @@ mod tests {
assert_eq!(
_select.build(DbBackend::Postgres).to_string(),
[
r#"SELECT "active_enum_child"."id", "active_enum_child"."parent_id", "active_enum_child"."category", "active_enum_child"."color", CAST("active_enum_child"."tea" AS text)"#,
r#"SELECT "active_enum_child"."id", "active_enum_child"."parent_id", "active_enum_child"."category", "active_enum_child"."color", CAST("active_enum_child"."tea" AS "text")"#,
r#"FROM "public"."active_enum_child""#,
r#"INNER JOIN "public"."active_enum" ON "active_enum"."id" = "active_enum_child"."parent_id""#,
r#"WHERE "active_enum"."id" = 1"#,
Expand Down Expand Up @@ -746,8 +746,8 @@ mod tests {
.build(DbBackend::Postgres)
.to_string(),
[
r#"SELECT "active_enum"."id" AS "A_id", "active_enum"."category" AS "A_category", "active_enum"."color" AS "A_color", CAST("active_enum"."tea" AS text) AS "A_tea","#,
r#""active_enum_child"."id" AS "B_id", "active_enum_child"."parent_id" AS "B_parent_id", "active_enum_child"."category" AS "B_category", "active_enum_child"."color" AS "B_color", CAST("active_enum_child"."tea" AS text) AS "B_tea""#,
r#"SELECT "active_enum"."id" AS "A_id", "active_enum"."category" AS "A_category", "active_enum"."color" AS "A_color", CAST("active_enum"."tea" AS "text") AS "A_tea","#,
r#""active_enum_child"."id" AS "B_id", "active_enum_child"."parent_id" AS "B_parent_id", "active_enum_child"."category" AS "B_category", "active_enum_child"."color" AS "B_color", CAST("active_enum_child"."tea" AS "text") AS "B_tea""#,
r#"FROM "public"."active_enum""#,
r#"LEFT JOIN "public"."active_enum_child" ON "active_enum"."id" = "active_enum_child"."parent_id""#,
]
Expand Down Expand Up @@ -791,7 +791,7 @@ mod tests {
assert_eq!(
_select.build(DbBackend::Postgres).to_string(),
[
r#"SELECT "active_enum_child"."id", "active_enum_child"."parent_id", "active_enum_child"."category", "active_enum_child"."color", CAST("active_enum_child"."tea" AS text)"#,
r#"SELECT "active_enum_child"."id", "active_enum_child"."parent_id", "active_enum_child"."category", "active_enum_child"."color", CAST("active_enum_child"."tea" AS "text")"#,
r#"FROM "public"."active_enum_child""#,
r#"INNER JOIN "public"."active_enum" AS "r0" ON "r0"."id" = "active_enum_child"."parent_id""#,
r#"WHERE "r0"."id" = 1"#,
Expand Down Expand Up @@ -833,8 +833,8 @@ mod tests {
.build(DbBackend::Postgres)
.to_string(),
[
r#"SELECT "active_enum"."id" AS "A_id", "active_enum"."category" AS "A_category", "active_enum"."color" AS "A_color", CAST("active_enum"."tea" AS text) AS "A_tea","#,
r#""r0"."id" AS "B_id", "r0"."parent_id" AS "B_parent_id", "r0"."category" AS "B_category", "r0"."color" AS "B_color", CAST("r0"."tea" AS text) AS "B_tea""#,
r#"SELECT "active_enum"."id" AS "A_id", "active_enum"."category" AS "A_category", "active_enum"."color" AS "A_color", CAST("active_enum"."tea" AS "text") AS "A_tea","#,
r#""r0"."id" AS "B_id", "r0"."parent_id" AS "B_parent_id", "r0"."category" AS "B_category", "r0"."color" AS "B_color", CAST("r0"."tea" AS "text") AS "B_tea""#,
r#"FROM "public"."active_enum""#,
r#"LEFT JOIN "public"."active_enum_child" AS "r0" ON "active_enum"."id" = "r0"."parent_id""#,
]
Expand Down Expand Up @@ -879,7 +879,7 @@ mod tests {
assert_eq!(
_select.build(DbBackend::Postgres).to_string(),
[
r#"SELECT "active_enum"."id", "active_enum"."category", "active_enum"."color", CAST("active_enum"."tea" AS text)"#,
r#"SELECT "active_enum"."id", "active_enum"."category", "active_enum"."color", CAST("active_enum"."tea" AS "text")"#,
r#"FROM "public"."active_enum""#,
r#"INNER JOIN "public"."active_enum_child" ON "active_enum_child"."parent_id" = "active_enum"."id""#,
r#"WHERE "active_enum_child"."id" = 1"#,
Expand Down Expand Up @@ -921,8 +921,8 @@ mod tests {
.build(DbBackend::Postgres)
.to_string(),
[
r#"SELECT "active_enum_child"."id" AS "A_id", "active_enum_child"."parent_id" AS "A_parent_id", "active_enum_child"."category" AS "A_category", "active_enum_child"."color" AS "A_color", CAST("active_enum_child"."tea" AS text) AS "A_tea","#,
r#""active_enum"."id" AS "B_id", "active_enum"."category" AS "B_category", "active_enum"."color" AS "B_color", CAST("active_enum"."tea" AS text) AS "B_tea""#,
r#"SELECT "active_enum_child"."id" AS "A_id", "active_enum_child"."parent_id" AS "A_parent_id", "active_enum_child"."category" AS "A_category", "active_enum_child"."color" AS "A_color", CAST("active_enum_child"."tea" AS "text") AS "A_tea","#,
r#""active_enum"."id" AS "B_id", "active_enum"."category" AS "B_category", "active_enum"."color" AS "B_color", CAST("active_enum"."tea" AS "text") AS "B_tea""#,
r#"FROM "public"."active_enum_child""#,
r#"LEFT JOIN "public"."active_enum" ON "active_enum_child"."parent_id" = "active_enum"."id""#,
]
Expand Down Expand Up @@ -967,7 +967,7 @@ mod tests {
assert_eq!(
_select.build(DbBackend::Postgres).to_string(),
[
r#"SELECT "active_enum"."id", "active_enum"."category", "active_enum"."color", CAST("active_enum"."tea" AS text)"#,
r#"SELECT "active_enum"."id", "active_enum"."category", "active_enum"."color", CAST("active_enum"."tea" AS "text")"#,
r#"FROM "public"."active_enum""#,
r#"INNER JOIN "public"."active_enum_child" AS "r0" ON "r0"."parent_id" = "active_enum"."id""#,
r#"WHERE "r0"."id" = 1"#,
Expand Down Expand Up @@ -1009,8 +1009,8 @@ mod tests {
.build(DbBackend::Postgres)
.to_string(),
[
r#"SELECT "active_enum_child"."id" AS "A_id", "active_enum_child"."parent_id" AS "A_parent_id", "active_enum_child"."category" AS "A_category", "active_enum_child"."color" AS "A_color", CAST("active_enum_child"."tea" AS text) AS "A_tea","#,
r#""r0"."id" AS "B_id", "r0"."category" AS "B_category", "r0"."color" AS "B_color", CAST("r0"."tea" AS text) AS "B_tea""#,
r#"SELECT "active_enum_child"."id" AS "A_id", "active_enum_child"."parent_id" AS "A_parent_id", "active_enum_child"."category" AS "A_category", "active_enum_child"."color" AS "A_color", CAST("active_enum_child"."tea" AS "text") AS "A_tea","#,
r#""r0"."id" AS "B_id", "r0"."category" AS "B_category", "r0"."color" AS "B_color", CAST("r0"."tea" AS "text") AS "B_tea""#,
r#"FROM "public"."active_enum_child""#,
r#"LEFT JOIN "public"."active_enum" AS "r0" ON "active_enum_child"."parent_id" = "r0"."id""#,
]
Expand Down