New note date field defaults to empty on upgraded sites
I think this fix is simple, but wanted a quick sanity check to make sure I'm not missing anything.
We noticed the problem on a 5.39 site that was upgraded from 5.33.
Thanks to the awesome note date field changes we now have a date created field for notes.
And, from what I can gather from the thread, the intent is to populate the note date with the current time stamp if left empty.
I tested this on a fresh install and it works great. But on upgraded sites, it leaves the note_date
field empty.
I believe the problem is that the upgrade code explicitly sets this field to accept NULL values.
However, if you grep for note_date
in sql/civicrm.mysql
it's not specified:
sql/civicrm.mysql: `note_date` timestamp DEFAULT CURRENT_TIMESTAMP COMMENT 'Date attached to the note',
So I think the fix is to add an upgrade script for the next upgrade to alter this field and ensure it is set to NOT NULL
.