summaryrefslogtreecommitdiffstats
path: root/update_db.php
diff options
context:
space:
mode:
authorArun Persaud <arun@nubati.net>2010-03-13 15:59:07 -0800
committerArun Persaud <arun@nubati.net>2010-03-13 16:05:39 -0800
commit850378a3e2da48d387dc565cc6e3c2b47f12e34d (patch)
tree440028bb1cdcdf1d00bb67b73319a047ec726c2b /update_db.php
parentcf764594cd00e66ee812c5d63b016bf286178f67 (diff)
downloade-DoKo-850378a3e2da48d387dc565cc6e3c2b47f12e34d.tar.gz
e-DoKo-850378a3e2da48d387dc565cc6e3c2b47f12e34d.tar.bz2
e-DoKo-850378a3e2da48d387dc565cc6e3c2b47f12e34d.zip
NEW FEATURE: having only low trump (fox and below) can now be a Vorbehalt
The low trump can either be treated as poverty or similar to 5 nines, that is the game is canceled unless someone plays a solo. Also minor code cleanup.
Diffstat (limited to 'update_db.php')
-rw-r--r--update_db.php16
1 files changed, 14 insertions, 2 deletions
diff --git a/update_db.php b/update_db.php
index deae974..498b24e 100644
--- a/update_db.php
+++ b/update_db.php
@@ -28,7 +28,8 @@ include_once("./include/functions.php"); /* the rest */
config_check();
/* open the database */
-if(DB_open()<0)
+$return = DB_open();
+if($return<0 && $return != -2) /* -2 = wrong DB version is ok */
exit();
/* only callable via cron or CLI */
@@ -36,7 +37,7 @@ if(isset($_SERVER['REMOTE_ADDR']))
exit();
$old_version = DB_get_version();
-$current_version = 1;
+$current_version = 2;
if($old_version < $current_version)
echo "Will upgrade your database now:\n";
@@ -56,6 +57,17 @@ switch($old_version)
" index (email))");
DB_query("UPDATE Version set version=1");
echo "Upgraded to version 1.\n";
+ case 1:
+ /* add new rules */
+ DB_query("ALTER TABLE Rulesets".
+ " ADD COLUMN `lowtrump` enum('poverty','cancel','none') default 'poverty' AFTER schweinchen");
+ DB_query("ALTER TABLE Hand".
+ " MODIFY COLUMN `sickness` enum('wedding','nines','poverty','solo','lowtrump') default NULL");
+ DB_query("ALTER TABLE Game".
+ " MODIFY COLUMN `status` enum('pre','play','gameover','cancel-timedout','cancel-nines','cancel-trump','cancel-noplay','cancel-lowtrump') default NULL");
+
+ DB_query("UPDATE Version set version=2");
+ echo "Upgraded to version 2.\n";
}
?> \ No newline at end of file