0

I had v2 of the CiviMobile extension installed on a WP/Civi site for testing to see how the mobile app would perform. I see that a new version of the app and the extension has been released, so tried to update the extension and just keep getting a fatal error. Looking at the log, it appears to be caused by an incorrect default value that the extension is trying to set in the 'civicrm_contact_push_notification_messages' table:

   string(986) "CREATE TABLE IF NOT EXISTS  `civicrm_contact_push_notification_messages` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `contact_id` int(10) unsigned NOT NULL,
  `message` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `entity_table` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `entity_id` int(11) DEFAULT NULL,
  `send_date` datetime DEFAULT CURRENT_TIMESTAMP,
  `is_read` tinyint(4) DEFAULT '0',

How can I address this and get the extension installed?

  • can you add the db error you get when upgrading the extension? – Pradeep Nayak Apr 26 '19 at 9:10
  • I see this line: CONSTRAINT FK_civicrm_contact_push_notification_message FOREIGN KEY (contact_id) REFERENCES civicrm_contact (id) ON DELETE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci [nativecode=1067 ** Invalid default value for 'send_date']" (sorry, thought I'd included this in the original post). – Graham Apr 26 '19 at 12:41
1

I think this might be the issue. As posted here: https://dba.stackexchange.com/questions/132951/cant-default-date-to-current-timestamp-in-mysql-5-5 Versions of MySQL from 5.6.x will support this, but I'm currently running 5.5.62 which does not support CURRENT_TIMESTAMP as a default option for a DATETIME. It suggests setting the column type as a TIMESTAMP. I wonder if that will break the extension, though? Interesting, as I though CiviCRM was now using TIMESTAMP by default across the board.

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.