Skip to content

Commit

Permalink
Change maillog.timestamp default to CURRENT_TIMESTAMP
Browse files Browse the repository at this point in the history
MySQL 5.7 and 8 won't complete the upgrade with a default value of zero when the default SQL mode is set (NO_ZERO_DATE is on)
  • Loading branch information
endelwar committed Aug 22, 2017
1 parent 8d42943 commit fcecf26
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion upgrade.php
Expand Up @@ -480,7 +480,7 @@ function stringEndsWith($haystack, $needles)
echo pad(' - Fix schema for timestamp field in `maillog` table');
//First query removes ON UPDATE CURRENT_TIMESTAMP and sets a default different from CURRENT_TIMESTAMP
//Second query drops the default
$sql1 = 'ALTER TABLE `maillog` CHANGE `timestamp` `timestamp` TIMESTAMP NOT NULL DEFAULT 0';
$sql1 = 'ALTER TABLE `maillog` CHANGE `timestamp` `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP';
$sql2 = 'ALTER TABLE `maillog` ALTER COLUMN `timestamp` DROP DEFAULT';
executeQuery($sql1);
executeQuery($sql2, true);
Expand Down

0 comments on commit fcecf26

Please sign in to comment.