-
I have tried 4 types, never of them works. I use MySQL 8. I create table by myself without `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
#[sea_orm(table_name = "product")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: i64,
pub name: String,
pub operator: String,
pub status: i32,
pub created_at: DateTime<FixedOffset>,
pub updated_at: DateTime<FixedOffset>,
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
panic!("No RelationDef")
}
}
impl ActiveModelBehavior for ActiveModel {}
Err(Query("error occurred while decoding column \"created_at\": mismatched types; Rust type `core::option::Option<chrono::naive::datetime::NaiveDateTime>` (as SQL type `DATETIME`) is not compatible with SQL type `TIMESTAMP`"))
error: proc-macro derive panicked
--> src/database/product.rs:8:35
|
8 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
| ^^^^^^^^^^^^^^^^^
|
= help: message: `"DateTime<Utc>"` is not a valid identifier
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Hi @lz1998, welcome!! Can you try Lines 24 to 29 in cc49049 |
Beta Was this translation helpful? Give feedback.
-
For anyone who was watching this discussion. A issue was created for this discussion. |
Beta Was this translation helpful? Give feedback.
For anyone who was watching this discussion. A issue was created for this discussion.