0
0
mirror of https://github.com/postfixadmin/postfixadmin.git synced 2024-09-19 19:22:14 +02:00

explode on errors when performing db upgrade; try and fix #498 by updating domain created/modified columns to something MySQL might be happier with

This commit is contained in:
David Goodwin 2021-05-08 20:11:58 +01:00
parent 3963c02239
commit 59f0b89233

View File

@ -342,6 +342,8 @@ function db_query_parsed($sql, $ignore_errors = 0, $attach_mysql = "")
if ($debug) {
echo_out("<div style='color:#f00'>" . $e->getMessage() . "</div>");
}
throw new \Exception("Postfixadmin DB update failed. Please check your PHP error_log");
}
}
/**
@ -1990,6 +1992,13 @@ function upgrade_1841_sqlite()
*/
function upgrade_1842()
{
$domain = table_by_key('domain');
// See: https://github.com/postfixadmin/postfixadmin/issues/489
// Avoid : ERROR 1292 (22007): Incorrect datetime value: '0000-00-00 00:00:00' for column 'created' at row 1
if (db_mysql()) {
db_execute("UPDATE $domain SET created='2000-01-01 00:00:00', modified='2000-01-01 00:00:00' WHERE domain='ALL'", [], true);
}
_db_add_field('mailbox', 'password_expiry', "{DATETIME}"); // when a specific mailbox password expires
_db_add_field('domain', 'password_expiry', 'int DEFAULT 0'); // expiry applied to mailboxes within that domain
}
@ -2014,7 +2023,7 @@ function upgrade_1844()
if (db_sqlite()) {
return;
}
_db_add_field('domain_admins', 'id', '{AUTOINCREMENT} {PRIMARY}');
}