From ccc5b9334892c4d9382d2110e583d64e093317db Mon Sep 17 00:00:00 2001 From: John Flatness Date: Wed, 12 Apr 2017 12:09:34 -0400 Subject: [PATCH] Improve compatibility of removeZeroDates migration Some MySQL versions (confirmed on 5.7.17) error immediately on any UPDATE that even includes a "zero" date in the WHERE clause. IGNORE is required to make the query execute. (cherry picked from commit d583ac0018bb2a2d1a93392ce56293b50fcb2d40) --- .../migrations/20151209103299_removeZeroDates.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/application/migrations/20151209103299_removeZeroDates.php b/application/migrations/20151209103299_removeZeroDates.php index eefb9d07e3..8188813acf 100644 --- a/application/migrations/20151209103299_removeZeroDates.php +++ b/application/migrations/20151209103299_removeZeroDates.php @@ -19,11 +19,11 @@ class removeZeroDates extends Omeka_Db_Migration_AbstractMigration { public function up() { - $this->db->query("UPDATE {$this->db->Collection} SET `added` = '2000-01-01 00:00:00' WHERE `added` = '0000-00-00 00:00:00'"); - $this->db->query("UPDATE {$this->db->Collection} SET `modified` = '2000-01-01 00:00:00' WHERE `modified` = '0000-00-00 00:00:00'"); - $this->db->query("UPDATE {$this->db->File} SET `added` = '2000-01-01 00:00:00' WHERE `added` = '0000-00-00 00:00:00'"); - $this->db->query("UPDATE {$this->db->Item} SET `added` = '2000-01-01 00:00:00' WHERE `added` = '0000-00-00 00:00:00'"); - $this->db->query("UPDATE {$this->db->Process} SET `started` = '2000-01-01 00:00:00' WHERE `started` = '0000-00-00 00:00:00'"); - $this->db->query("UPDATE {$this->db->Process} SET `stopped` = '2000-01-01 00:00:00' WHERE `stopped` = '0000-00-00 00:00:00'"); + $this->db->query("UPDATE IGNORE {$this->db->Collection} SET `added` = '2000-01-01 00:00:00' WHERE `added` = '0000-00-00 00:00:00'"); + $this->db->query("UPDATE IGNORE {$this->db->Collection} SET `modified` = '2000-01-01 00:00:00' WHERE `modified` = '0000-00-00 00:00:00'"); + $this->db->query("UPDATE IGNORE {$this->db->File} SET `added` = '2000-01-01 00:00:00' WHERE `added` = '0000-00-00 00:00:00'"); + $this->db->query("UPDATE IGNORE {$this->db->Item} SET `added` = '2000-01-01 00:00:00' WHERE `added` = '0000-00-00 00:00:00'"); + $this->db->query("UPDATE IGNORE {$this->db->Process} SET `started` = '2000-01-01 00:00:00' WHERE `started` = '0000-00-00 00:00:00'"); + $this->db->query("UPDATE IGNORE {$this->db->Process} SET `stopped` = '2000-01-01 00:00:00' WHERE `stopped` = '0000-00-00 00:00:00'"); } }