Skip to content

Add a datetime-default-now helper function - #3159

Open
goodspark wants to merge 1 commit into
SeaQL:masterfrom
goodspark:helpers
Open

Add a datetime-default-now helper function#3159
goodspark wants to merge 1 commit into
SeaQL:masterfrom
goodspark:helpers

Conversation

@goodspark

Copy link
Copy Markdown

I found I was writing this a lot in my migrations. So why not just put it in the library?

New Features

  • Adds a date_time_default_now helper function for migrations.

I found I was writing this a lot in my migrations. So why not just put
it in the library?
}

/// 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants