Skip to content

Commit

Permalink
Providing an upgrade script for people suffering from #559
Browse files Browse the repository at this point in the history
  • Loading branch information
evert committed Aug 19, 2016
1 parent f04ba37 commit 75e3daf
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions Core/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,36 @@ protected function upgrade($sVersionFrom, $sVersionTo) {
}

}
if (version_compare($sVersionFrom, '0.4.5', '<=')) {

// Similar to upgrading from older than 0.4.5, there were still
// issues with a missing DEFAULT 1 for sthe synctoken field in the
// addressbook.
if (!defined("PROJECT_DB_MYSQL") || PROJECT_DB_MYSQL === false) {

$pdo->exec('UPDATE addressbooks SET synctoken = 1 WHERE synctoken IS NULL');

$tmpTable = '_' . time();
$pdo->exec('ALTER TABLE addressbooks RENAME TO addressbooks' . $tmpTable);

$pdo->exec('
CREATE TABLE addressbooks (
id integer primary key asc NOT NULL,
principaluri text NOT NULL,
displayname text,
uri text NOT NULL,
description text,
synctoken integer DEFAULT 1 NOT NULL
);
');

$pdo->exec('INSERT INTO addressbooks SELECT id, principaluri, displayname, uri, description, synctoken FROM addressbooks' . $tmpTable);
$this->aSuccess[] = 'Updated addressbooks tables';

}

}


$this->updateConfiguredVersion($sVersionTo);
return true;
Expand Down

0 comments on commit 75e3daf

Please sign in to comment.