Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not set CreatedAt if blank during Save #2207

Merged
merged 2 commits into from
Jan 2, 2019
Merged

Conversation

efournival
Copy link
Contributor

Make sure these boxes checked before submitting your pull request.

  • Do only one thing
  • No API-breaking changes
  • New code/logic commented & tested

For significant changes like big bug fixes, new features, please open an issue to make an agreement on an implementation design/plan first before starting it.

What did this pull request do?

This PR keeps the CreatedAt field from being updated if blank when calling update callbacks. This is mostly occuring when calling Save() for a record with a primary key.

In my case, CreatedAt was always put to '0001-01-01 00:00:00' when updating existing relations through calling Updates() on the parent model.

This fixes #1818, #1838 and (partially) #2123.

@entrehuihui
Copy link

I also encountered this problem. I hope that I will not update CreatedAt when using save.

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.

"Save" overrides createdAt time with zero time
3 participants