Skip to content

Commit

Permalink
Fix update schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Ysurac committed Sep 27, 2016
1 parent ef9e888 commit caccdb6
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions install/class.update_schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -748,17 +748,19 @@ private static function update_from_20() {
}

private static function update_from_21() {
$Connection = new Connection();
$Connection = new Connection();
$error = '';
// Rename type to stats_type
$query = "ALTER TABLE `stats_airport` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats_flight` CHANGE `type` `stats_type` VARCHAR(50);";
try {
$sth = $Connection->db->prepare($query);
$sth->execute();
} catch(PDOException $e) {
return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n";
}
if ($error != '') return $error;
if (!$Connection->checkColumnName('stats_airport','stats_type')) {
// Rename type to stats_type
$query = "ALTER TABLE `stats_airport` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats_flight` CHANGE `type` `stats_type` VARCHAR(50);";
try {
$sth = $Connection->db->prepare($query);
$sth->execute();
} catch(PDOException $e) {
return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n";
}
if ($error != '') return $error;
}
$query = "UPDATE `config` SET `value` = '22' WHERE `name` = 'schema_version'";
try {
$sth = $Connection->db->prepare($query);
Expand Down

0 comments on commit caccdb6

Please sign in to comment.