date column default
Prior to v7 a DATE column would automatically default to today's date when a new row was inserted. This no longer happens. Any ideas on why this change?
yes. a user put up lots of posts on how his company needed this to be so, and it was changed accordingly.
I think of him and his needs every few days when I have to enter lots of expenses into a table by hand, and have to explicitly type today´s date for every one.
I think of him and his needs every few days when I have to enter lots of expenses into a table by hand, and have to explicitly type today´s date for every one.
Exactly, see issue #2708. I tend to revert that stuff. There are more people asking for this removed feature than there are complaining about this good default value.
Wow, there sure has been lots of discussion on this and I'm almost sorry for opening this can of worms again. Had I been aware of it I would have certainly weighed in.
Here's my take: Although in theory I agree with djdjohnson that heidi shouldn't modify existing values I have to wonder why any good database designer would allow a NULL in a date field? I also agree with jfalch that preventing incorrect data entry is more appropriate of a custom data entry system, not a mysql qui. But that's another discussion.
How about either (or both) of these compromises?
1. Make the default of NULLs a configurable item. Even better, allow defaults to be defined as the result of a function. In my case the default of the DATE column could be the output of curdate(). It would correct what in my view is a serious defect of mysql.
2. Provide a configurable shortcut for the context menu. As it now exists the only shortcut is for the NULL.
In the absence of either it would be wonderful if the context menu were available in edit mode as well. As it now stands, we who liked the previous default behavior now must use quite a few additional keystrokes or mouse clicks to get something that used to be automatic.
Since my solutions will require coding only anse can determine their feasibility. Frankly I'm grateful heidi even exists so thank you anse.
Here's my take: Although in theory I agree with djdjohnson that heidi shouldn't modify existing values I have to wonder why any good database designer would allow a NULL in a date field? I also agree with jfalch that preventing incorrect data entry is more appropriate of a custom data entry system, not a mysql qui. But that's another discussion.
How about either (or both) of these compromises?
1. Make the default of NULLs a configurable item. Even better, allow defaults to be defined as the result of a function. In my case the default of the DATE column could be the output of curdate(). It would correct what in my view is a serious defect of mysql.
2. Provide a configurable shortcut for the context menu. As it now exists the only shortcut is for the NULL.
In the absence of either it would be wonderful if the context menu were available in edit mode as well. As it now stands, we who liked the previous default behavior now must use quite a few additional keystrokes or mouse clicks to get something that used to be automatic.
Since my solutions will require coding only anse can determine their feasibility. Frankly I'm grateful heidi even exists so thank you anse.
See issue #2708
Done. See Tools > Preferences > Data > "Prefill empty date/time fields". This is by default checked, so NULLs are again automatically filled with a SELECT NOW() result. If you uncheck that option, the editor starts with an empty mask, and leaving the editor without entering anyting won't touch the originaly value.
Please login to leave a reply, or register at first.