Repository: SeaQL/sea-orm (rust)

Issue:
Support for sql type DATE
Hi,  
I will be great to have the support of the sql type `DATE` in the library.  
I imagine this one will be done with `chrono::NaiveDate` since it's the one that is used in the [documentation](https://www.sea-ql.org/SeaORM/docs/generate-entity/entity-structure#column-type). 

To give my own example, I have a model `Rate` which have a simple date:

```rust
use chrono::NaiveDate;
use sea_orm::entity::prelude::*;
use sea_orm::DeriveEntityModel;

#[derive(Debug, Clone, PartialEq, DeriveEntityModel)]
#[sea_orm(table_name = "currency_exchange_rate")]
pub struct Model {
    #[sea_orm(primary_key)]
    pub currency_exchange_rate_id: i64,
    pub from_currency: String,
    pub to_currency: String,
    pub rate_date: NaiveDate,
    pub rate: f64,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {}

impl ActiveModelBehavior for ActiveModel {}
```

But this implementation give me a compile error:

```
error[E0277]: the trait bound `NaiveDate: TryGetable` is not satisfied
  --> src/rates/mod.rs:11:35
   |
11 | #[derive(Debug, Clone, PartialEq, DeriveEntityModel)]
   |                                   ^^^^^^^^^^^^^^^^^ the trait `TryGetable` is not implemented for `NaiveDate`
   |
   = note: this error originates in the derive macro `DeriveEntityModel` (in Nightly builds, run with -Z macro-backtrace for more info)
```

Pull request:
Support `chrono::NaiveDate` & `chrono::NaiveTime`
- Resolve #206 
- Depends on
  - SeaQL/sea-query#149
  - launchbadge/sqlx#1459

Patch:
diff --git a/Cargo.toml b/Cargo.toml
index 37aa1b6e..d1ddf12e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -30,7 +30,7 @@ futures-util = { version = "^0.3" }
 log = { version = "^0.4", optional = true }
 rust_decimal = { version = "^1", optional = true }
 sea-orm-macros = { version = "^0.2.3", path = "sea-orm-macros", optional = true }
-sea-query = { version = "^0.16.3", features = ["thread-safe"] }
+sea-query = { version = "^0.16.5", features = ["thread-safe"] }
 sea-strum = { version = "^0.21", features = ["derive", "sea-orm"] }
 serde = { version = "^1.0", features = ["derive"] }
 serde_json = { version = "^1", optional = true }
diff --git a/sea-orm-macros/src/derives/entity_model.rs b/sea-orm-macros/src/derives/entity_model.rs
index f0772763..ba448bd4 100644
--- a/sea-orm-macros/src/derives/entity_model.rs
+++ b/sea-orm-macros/src/derives/entity_model.rs
@@ -170,8 +170,8 @@ pub fn expand_derive_entity_model(data: Data, attrs: Vec<Attribute>) -> syn::Res
                                 "f32" => quote! { Float },
                                 "f64" => quote! { Double },
                                 "bool" => quote! { Boolean },
-                                "NaiveDate" => quote! { Date },
-                                "NaiveTime" => quote! { Time },
+                                "Date" | "NaiveDate" => quote! { Date },
+                                "Time" | "NaiveTime" => quote! { Time },
                                 "DateTime" | "NaiveDateTime" => {
                                     quote! { DateTime }
                                 }
diff --git a/src/entity/prelude.rs b/src/entity/prelude.rs
index 8d87a4b2..fb89a454 100644
--- a/src/entity/prelude.rs
+++ b/src/entity/prelude.rs
@@ -9,6 +9,12 @@ pub use crate::{
 #[cfg(feature = "with-json")]
 pub use serde_json::Value as Json;
 
+#[cfg(feature = "with-chrono")]
+pub use chrono::NaiveDate as Date;
+
+#[cfg(feature = "with-chrono")]
+pub use chrono::NaiveTime as Time;
+
 #[cfg(feature = "with-chrono")]
 pub use chrono::NaiveDateTime as DateTime;
 
diff --git a/src/executor/query.rs b/src/executor/query.rs
index ae09f97c..9fda50ff 100644
--- a/src/executor/query.rs
+++ b/src/executor/query.rs
@@ -241,6 +241,12 @@ try_getable_all!(Vec<u8>);
 #[cfg(feature = "with-json")]
 try_getable_all!(serde_json::Value);
 
+#[cfg(feature = "with-chrono")]
+try_getable_all!(chrono::NaiveDate);
+
+#[cfg(feature = "with-chrono")]
+try_getable_all!(chrono::NaiveTime);
+
 #[cfg(feature = "with-chrono")]
 try_getable_all!(chrono::NaiveDateTime);
 


Test patch:
diff --git a/tests/common/bakery_chain/metadata.rs b/tests/common/bakery_chain/metadata.rs
index 95a7a48b..9130bbbd 100644
--- a/tests/common/bakery_chain/metadata.rs
+++ b/tests/common/bakery_chain/metadata.rs
@@ -8,6 +8,8 @@ pub struct Model {
     pub key: String,
     pub value: String,
     pub bytes: Vec<u8>,
+    pub date: Date,
+    pub time: Time,
 }
 
 #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
diff --git a/tests/common/setup/schema.rs b/tests/common/setup/schema.rs
index 64f31dfe..74e3d390 100644
--- a/tests/common/setup/schema.rs
+++ b/tests/common/setup/schema.rs
@@ -286,6 +286,8 @@ pub async fn create_metadata_table(db: &DbConn) -> Result<ExecResult, DbErr> {
         .col(ColumnDef::new(metadata::Column::Key).string().not_null())
         .col(ColumnDef::new(metadata::Column::Value).string().not_null())
         .col(ColumnDef::new(metadata::Column::Bytes).binary().not_null())
+        .col(ColumnDef::new(metadata::Column::Date).date().not_null())
+        .col(ColumnDef::new(metadata::Column::Time).time().not_null())
         .to_owned();
 
     create_table(db, &stmt, Metadata).await
diff --git a/tests/parallel_tests.rs b/tests/parallel_tests.rs
index 0ac09fd6..6e18cb52 100644
--- a/tests/parallel_tests.rs
+++ b/tests/parallel_tests.rs
@@ -25,18 +25,24 @@ pub async fn crud_in_parallel(db: &DatabaseConnection) -> Result<(), DbErr> {
             key: "markup".to_owned(),
             value: "1.18".to_owned(),
             bytes: vec![1, 2, 3],
+            date: Date::from_ymd(2021, 9, 27),
+            time: Time::from_hms(11, 32, 55),
         },
         metadata::Model {
             uuid: Uuid::new_v4(),
             key: "exchange_rate".to_owned(),
             value: "0.78".to_owned(),
             bytes: vec![1, 2, 3],
+            date: Date::from_ymd(2021, 9, 27),
+            time: Time::from_hms(11, 32, 55),
         },
         metadata::Model {
             uuid: Uuid::new_v4(),
             key: "service_charge".to_owned(),
             value: "1.1".to_owned(),
             bytes: vec![1, 2, 3],
+            date: Date::from_ymd(2021, 9, 27),
+            time: Time::from_hms(11, 32, 55),
         },
     ];
 
diff --git a/tests/uuid_tests.rs b/tests/uuid_tests.rs
index e58daca4..bf13f689 100644
--- a/tests/uuid_tests.rs
+++ b/tests/uuid_tests.rs
@@ -23,6 +23,8 @@ pub async fn create_metadata(db: &DatabaseConnection) -> Result<(), DbErr> {
         key: "markup".to_owned(),
         value: "1.18".to_owned(),
         bytes: vec![1, 2, 3],
+        date: Date::from_ymd(2021, 9, 27),
+        time: Time::from_hms(11, 32, 55),
     };
 
     let res = Metadata::insert(metadata.clone().into_active_model())