From 63c764d6a4fa8d9d08ffc5928a74a1460fcb22d9 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Mon, 15 Nov 2021 21:27:27 +0800 Subject: [PATCH 1/3] `with-json` feature requires `chrono/serde` --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 2345844cd..46d972dd7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -63,7 +63,7 @@ default = [ ] macros = ["sea-orm-macros"] mock = [] -with-json = ["serde_json", "sea-query/with-json"] +with-json = ["serde_json", "sea-query/with-json", "chrono/serde"] with-chrono = ["chrono", "sea-query/with-chrono"] with-rust_decimal = ["rust_decimal", "sea-query/with-rust_decimal"] with-uuid = ["uuid", "sea-query/with-uuid"] From 1c4fc11efeb9c0b2bf6a9dc7eedd4412033fc8d7 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Mon, 15 Nov 2021 21:27:54 +0800 Subject: [PATCH 2/3] Test [issues] --- issues/319/Cargo.toml | 18 ++++++++++++++++++ issues/319/src/main.rs | 14 ++++++++++++++ issues/319/src/material.rs | 20 ++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 issues/319/Cargo.toml create mode 100644 issues/319/src/main.rs create mode 100644 issues/319/src/material.rs diff --git a/issues/319/Cargo.toml b/issues/319/Cargo.toml new file mode 100644 index 000000000..3eb4adaa3 --- /dev/null +++ b/issues/319/Cargo.toml @@ -0,0 +1,18 @@ +[workspace] +# A separate workspace + +[package] +name = "sea-orm-issues-319" +version = "0.1.0" +edition = "2021" +publish = false + +[dependencies] +async-std = { version = "^1", features = ["attributes"] } +serde = { version = "^1", features = ["derive"] } +sea-orm = { path = "../../", features = [ + "sqlx-mysql", + "runtime-async-std-native-tls", + "with-json", + "macros", +], default-features = false } diff --git a/issues/319/src/main.rs b/issues/319/src/main.rs new file mode 100644 index 000000000..1710c37cf --- /dev/null +++ b/issues/319/src/main.rs @@ -0,0 +1,14 @@ +mod material; +use sea_orm::*; + +#[async_std::main] +pub async fn main() { + let db = Database::connect("mysql://sea:sea@localhost/bakery") + .await + .unwrap(); + + async_std::task::spawn(async move { + material::Entity::find().one(&db).await.unwrap(); + }) + .await; +} diff --git a/issues/319/src/material.rs b/issues/319/src/material.rs new file mode 100644 index 000000000..9586189d4 --- /dev/null +++ b/issues/319/src/material.rs @@ -0,0 +1,20 @@ +use sea_orm::entity::prelude::*; +use serde::{Serialize, Deserialize}; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)] +#[sea_orm(table_name = "materials")] +pub struct Model { + #[sea_orm(primary_key)] + pub id: i32, + pub created_at: DateTimeWithTimeZone, + pub updated_at: DateTimeWithTimeZone, + pub name: String, + #[sea_orm(column_type = "Text", nullable)] + pub description: Option, + pub tag_ids: Vec, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation {} + +impl ActiveModelBehavior for ActiveModel {} From 2e5534279d21ba68075ec3ecdc1d9c3864efd7ea Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Mon, 15 Nov 2021 22:16:15 +0800 Subject: [PATCH 3/3] Test [issues] --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index ad18203e4..40c20d019 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -314,7 +314,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - path: [86, 249, 262] + path: [86, 249, 262, 319] steps: - uses: actions/checkout@v2