0

Not much ( not at all ) regarding this found via https://lab.civicrm.org/groups/dev/-/issues.

[code] => -1
[message] => DB Error: unknown error
[mode] => 16
[debug_info] => ALTER TABLE civicrm_note CHANGE COLUMN
`note_date` `note_date` timestamp NOT NULL DEFAULT
current_timestamp() COMMENT 'Date attached to the note'
[nativecode=1138 ** Invalid use of NULL value]
[type] => DB_Error
[user_info] => ALTER TABLE civicrm_note CHANGE COLUMN `note_date`
`note_date` timestamp NOT NULL DEFAULT current_timestamp() COMMENT
'Date attached to the note' [nativecode=1138 ** Invalid use of NULL
value]
[to_string] => [db_error: message="DB Error: unknown error"
code=-1 mode=callback callback=CRM_Core_Error::exceptionHandler
prefix="" info="ALTER TABLE civicrm_note CHANGE COLUMN `note_date`
`note_date` timestamp NOT NULL DEFAULT current_timestamp() COMMENT
 Date attached to the note' [nativecode=1138 ** Invalid use of NULL
 value]"]
 )

PEAR_Exception: "DB Error: unknown error"
* ERROR TYPE: DB_Error
* ERROR CODE: -1
* ERROR MESSAGE: DB Error: unknown error
* ERROR MODE: 16
* ERROR USERINFO: ALTER TABLE civicrm_note CHANGE COLUMN `note_date` `note_date` 
timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Date attached to the note' 
[nativecode=1138 ** Invalid use of NULL value]
* ERROR DEBUGINFO: ALTER TABLE civicrm_note CHANGE COLUMN `note_date` `note_date` 
timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Date attached to the note' 
[nativecode=1138 ** Invalid use of NULL value]
#0 /var/www/drupal/sites/all/modules/civicrm/vendor/pear/pear-core- 
minimal/src/PEAR.php(922): CRM_Core_Error::exceptionHandler(Object(DB_Error))
#1 /var/www/drupal/sites/all/modules/civicrm/vendor/pear/db/DB.php(998): PEAR_Error- 
>__construct("DB Error: unknown error", -1, 16, (Array:2), "ALTER TABLE civicrm_note 
CHANGE COLUMN `note_date` `note_date` timestamp NOT ...")
2

Issue caused by empty timestamps in 'civicrm_note' according to this
The fix: run MySQL query before upgrade or if/when upgrade stuck. In my case, this page http://example.org/civicrm/upgrade?reset=1 throws the MySQl error but after running the query below and refreshing the http://example.org/civicrm/upgrade?reset=1 it all went well.

UPDATE  `civicrm_note`
SET `note_date`  = CURRENT_TIMESTAMP
WHERE `note_date`  IS NULL;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.