Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions sea-orm-migration/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,11 @@ pub fn date_time_uniq<T: IntoIden>(col: T) -> ColumnDef {
date_time(col).unique_key().take()
}

/// A date time column with a server-side default of 'now'.
pub fn date_time_default_now<T: IntoIden>(col: T) -> ColumnDef {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now() != CURRENT_TIMESTAMP

Furthermore, CURRENT_TIMESTAMP has different semantics in different databases.

date_time(col).default(Expr::current_timestamp()).take()
}

pub fn interval<T: IntoIden>(
col: T,
fields: Option<PgInterval>,
Expand Down