Skip to content

Commit

Permalink
Simplified pre-0.4.0 upgrade script
Browse files Browse the repository at this point in the history
The 0.4.6 upgrade script partially does the same thing, and we only want
to do it once.
  • Loading branch information
evert committed Aug 19, 2016
1 parent 75e3daf commit f79c665
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions Core/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,22 +322,9 @@ protected function upgrade($sVersionFrom, $sVersionTo) {
if (!defined("PROJECT_DB_MYSQL") || PROJECT_DB_MYSQL === false) {

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

$tmpTable = '_' . time();
$pdo->exec('ALTER TABLE calendars RENAME TO calendars' . $tmpTable);
$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('
CREATE TABLE calendars (
Expand All @@ -355,9 +342,8 @@ protected function upgrade($sVersionFrom, $sVersionTo) {
);');

$pdo->exec('INSERT INTO calendars SELECT id, principaluri, displayname, uri, synctoken, description, calendarorder, calendarcolor, timezone, components, transparent FROM calendars' . $tmpTable);
$pdo->exec('INSERT INTO addressbooks SELECT id, principaluri, displayname, uri, description, synctoken FROM addressbooks' . $tmpTable);

$this->aSuccess[] = 'Updated calendars and addressbooks tables';
$this->aSuccess[] = 'Updated calendars table';

}

Expand Down Expand Up @@ -386,7 +372,7 @@ protected function upgrade($sVersionFrom, $sVersionTo) {
');

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

}

Expand Down

0 comments on commit f79c665

Please sign in to comment.