How to set a default value for timestamp column? #1035
Answered
by
frederikhors
frederikhors
asked this question in
Q&A
-
Can you help me understand how to set a default value for ColumnDef::new(Player::CreatedAt)
.timestamp()
.not_null()
.default(/*WHAT?*/) |
Beta Was this translation helpful? Give feedback.
Answered by
frederikhors
Sep 11, 2022
Replies: 2 comments 4 replies
-
I found out how (for now): SeaQL/sea-query#346. |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
frederikhors
-
I am creating my tables from the Model using schema.create_table_from_entity #[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
#[sea_orm(table_name = "configuration")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: i32,
#[sea_orm(default_value = CURRENT_TIMESTAMP)]
pub some_timestamp: String,
} This does not work because it expects some literal value. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I found out how (for now): SeaQL/sea-query#346.