Skip to content

Commit f15465a

Browse files
committed
Core: Show database error on upgrade
Addressbook: Check if comments module is installed
1 parent 8e8848d commit f15465a

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

www/go/core/Installer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ private function upgradeModules() {
788788

789789
} else {
790790

791-
$msg = $e->getCode() . ': '.$e->getMessage() . "\n".
791+
$msg = $e->getPrevious()->getCode() . ': '.$e->getPrevious()->getMessage() . "\n".
792792
"Query: " . $query . "\n".
793793
"Package: " . ($module->package ?? "legacy") . "\n".
794794
"Module: " . $module->name . "\n".

www/go/modules/community/addressbook/install/updates.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,18 @@
220220
$updates['202412031558'][] = "create index addressbook_contact_lastContactAt_index
221221
on addressbook_contact (lastContactAt);";
222222

223-
$updates['202412031558'][] = "update addressbook_contact c
223+
$updates['202412031558'][] = function() {
224+
if(go()->getDatabase()->hasTable("comments_comment")) {
225+
$sql = "update addressbook_contact c
224226
inner join comments_comment com on
225227
com.entityId = c.id and com.entityTypeId = (select id from core_entity where name='Contact')
226228
set c.lastContactAt = com.createdAt;";
227229

230+
echo "Running: " . $sql . "\n";
231+
go()->getDbConnection()->exec($sql);
232+
}
233+
};
234+
228235

229236
$updates['202412031558'][] = "alter table addressbook_contact
230237
add actionAt date null;";

0 commit comments

Comments
 (0)