Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Case-sensitive enum type casts #2271

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
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 "TeaType") WHERE "lunch_set"."tea" = (CAST('BreakfastTea' AS "TeaType"))"#,
);
}

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 "TeaType") WHERE "lunch_set"."id" = 1"#,
);
}
}
2 changes: 1 addition & 1 deletion src/tests_cfg/sea_orm_active_enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate as sea_orm;
use crate::entity::prelude::*;

#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum)]
#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "tea")]
#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "TeaType")]
pub enum Tea {
#[sea_orm(string_value = "EverydayTea")]
EverydayTea,
Expand Down
Loading