From 7b6cad00688de8f1847c7fc7101a2e5d50144a03 Mon Sep 17 00:00:00 2001 From: Simon Asika Date: Thu, 3 Aug 2017 18:26:02 +0800 Subject: [PATCH] Fix SQL strict mode --- src/Core/Migration/Repository/MigrationsRepository.php | 4 ++-- src/Core/Provider/DatabaseProvider.php | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Core/Migration/Repository/MigrationsRepository.php b/src/Core/Migration/Repository/MigrationsRepository.php index 01a1800c..fb164321 100644 --- a/src/Core/Migration/Repository/MigrationsRepository.php +++ b/src/Core/Migration/Repository/MigrationsRepository.php @@ -316,8 +316,8 @@ public function initLogTable($name = null) $table->create(function (Schema $schema) { $schema->varchar('version'); - $schema->timestamp('start_time'); - $schema->timestamp('end_time'); + $schema->timestamp('start_time')->allowNull(true)->defaultValue(null); + $schema->timestamp('end_time')->allowNull(true)->defaultValue(null); }); } diff --git a/src/Core/Provider/DatabaseProvider.php b/src/Core/Provider/DatabaseProvider.php index bf82fd60..d2f711c2 100644 --- a/src/Core/Provider/DatabaseProvider.php +++ b/src/Core/Provider/DatabaseProvider.php @@ -96,11 +96,12 @@ public function strictMode(MysqlDriver $db) 'ERROR_FOR_DIVISION_BY_ZERO', 'NO_AUTO_CREATE_USER', 'NO_ENGINE_SUBSTITUTION', + 'NO_ZERO_DATE', + 'NO_ZERO_IN_DATE' ); - // TODO: Re-enable this after we solve issue: https://github.com/ventoviro/windwalker/issues/451 -// $db->connect() -// ->getConnection() -// ->exec("SET @@SESSION.sql_mode = '" . implode(',', $modes) . "';"); + $db->connect() + ->getConnection() + ->exec("SET @@SESSION.sql_mode = '" . implode(',', $modes) . "';"); } }