X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=update_db.php;h=f6cccbc9a17fde334d878a2205cfd48ca6d0a339;hp=498b24e663317d22c7044fca8d36b94637c7df99;hb=HEAD;hpb=c581cd05476d07f0fd17dab41cbb211a443fd57f diff --git a/update_db.php b/update_db.php index 498b24e..f6cccbc 100644 --- a/update_db.php +++ b/update_db.php @@ -1,5 +1,5 @@ +/* Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Arun Persaud * * This file is part of e-DoKo. * @@ -22,6 +22,7 @@ error_reporting(E_ALL); include_once("config.php"); /* needs to be first in list, since other includes use this */ include_once("./include/db.php"); /* database only */ +include_once("./include/output.php"); /* the rest */ include_once("./include/functions.php"); /* the rest */ /* make sure that user has set all variables in config.php */ @@ -37,7 +38,7 @@ if(isset($_SERVER['REMOTE_ADDR'])) exit(); $old_version = DB_get_version(); -$current_version = 2; +$current_version = 5; if($old_version < $current_version) echo "Will upgrade your database now:\n"; @@ -68,6 +69,23 @@ switch($old_version) DB_query("UPDATE Version set version=2"); echo "Upgraded to version 2.\n"; + case 2: + DB_query("ALTER TABLE Comment". + " ADD COLUMN `game_id` int(11) default NULL AFTER play_id"); + DB_query("UPDATE Version set version=3"); + echo "Upgraded to version 3.\n"; + case 3: + DB_query("ALTER TABLE digest_email". + " ADD COLUMN `game_id` int(11) default NULL AFTER create_date"); + DB_query("ALTER TABLE digest_email". + " ADD COLUMN `type` enum('misc','your_turn') NOT NULL default 'misc' AFTER create_date"); + DB_query("UPDATE Version set version=4"); + echo "Upgraded to version 4.\n"; + case 4: + DB_query("ALTER TABLE User MODIFY password varchar(64)"); + DB_query("UPDATE Version set version=5"); + echo "Upgraded to version 5.\n"; + } ?> \ No newline at end of file