-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Bug: Model insert method always insert with current datetime on updatedField #3469
Comments
I suggest these following lines should be removed from Model public function insert()
|
This is intended. You can extend the Model class and make changes or prepare a PR to make it configurable. Personally I see no issues with current behavior. |
I understand, but can i ask why it is intended ? I just don't understand the reason, why when you create something has modified date set instead of NULL. Really there is no issue but the thinking is wrong. And because of this all system works the same way. Think about it when something is created has a modified date on it ? |
Because most of the time it's way easier to work with. There are basically two approaches to this. One is presented by you, and the second one implemented in the Model class. IMO there is no right or wrong solution here. There are trade-offs in both cases. E.g. if we would like to sort records by |
Thanks for reply. I really appreciate your answers. It seems like if you have updateField to null, you will have to sort the rows by two fields instead of one, still don't know why you would use COALESCE if updateField was null ? The sort works the same with only ORDER BY. Anyway, for me it does not make life easier but works fine like this.. i just had to tweak my queries a little. |
Hello i have this issue when i insert a new record always insert with updateField current datetime even if the field is default NULL
I inserted a new record raw from my mysql db to check if mysql automatically inserts this but it is not.
Insert Method from Codeigniter Model has inside these lines
from line 798 - 806
Why the $this->updatedField is even checked here ?
The text was updated successfully, but these errors were encountered: