diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index ab5d7663..4affff66 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -316,7 +316,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - path: [86, 249, 262, 319, 324, 352] + path: [86, 249, 262, 319, 324, 352, 356] steps: - uses: actions/checkout@v2 diff --git a/issues/356/Cargo.toml b/issues/356/Cargo.toml new file mode 100644 index 00000000..4e0e64d0 --- /dev/null +++ b/issues/356/Cargo.toml @@ -0,0 +1,11 @@ +[workspace] +# A separate workspace + +[package] +name = "sea-orm-issues-356" +version = "0.1.0" +edition = "2021" +publish = false + +[dependencies] +sea-orm = { path = "../../", features = [ "sqlx-mysql", "runtime-async-std-native-tls", "with-table-iden" ]} diff --git a/issues/356/src/main.rs b/issues/356/src/main.rs new file mode 100644 index 00000000..a9db43c3 --- /dev/null +++ b/issues/356/src/main.rs @@ -0,0 +1,3 @@ +mod model; + +pub fn main() {} diff --git a/issues/356/src/model.rs b/issues/356/src/model.rs new file mode 100644 index 00000000..44325a3a --- /dev/null +++ b/issues/356/src/model.rs @@ -0,0 +1,42 @@ +use sea_orm::entity::prelude::*; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[sea_orm(table_name = "model")] +pub struct Model { + #[sea_orm(primary_key)] + pub id: i32, + pub owner: String, + pub name: String, + pub description: String, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation {} + +impl ActiveModelBehavior for ActiveModel {} + +#[cfg(test)] +mod tests { + use super::*; + use sea_orm::*; + + #[test] + fn test_columns_1() { + assert_eq!( + Column::iter() + .map(|col| col.to_string()) + .collect::>(), + vec![ + "id".to_owned(), + "owner".to_owned(), + "name".to_owned(), + "description".to_owned(), + ] + ); + assert_eq!(Column::Table.to_string().as_str(), "model"); + assert_eq!(Column::Id.to_string().as_str(), "id"); + assert_eq!(Column::Owner.to_string().as_str(), "owner"); + assert_eq!(Column::Name.to_string().as_str(), "name"); + assert_eq!(Column::Description.to_string().as_str(), "description"); + } +}