Location: PHPKode > projects > Online Fantasy Football League > offl-0.2.6/www/upgrade/upgrade.php
<?php
/**
 * Upgrade script for OFFL 0.2.3 (run on 0.2.x)
 *
 * This patch upgrades an OFFL 0.2.x install to OFFL 0.2.3.  Notable changes include additional
 * game fields for description and playoff status.
 *
 * @author Stephen Rochelle <hide@address.com>
 * @version OFFL v0.2
 * @copyright Copyright (c) 2004 Stephen Rochelle.  Some rights reserved.
 * @package offl-ui
 */

$pageTitle = "";
require_once("offlconfig.php");
require_once($DOC_ROOT . "/lib/classes/offl_dbobject.php"); // gets database object for upgrading the DB.
require_once($DOC_ROOT . "/lib/classes/offl_league.php");
require_once($DOC_ROOT . "/lib/classes/offl_fflteam.php");
require_once($DOC_ROOT . "/lib/classes/offl_rosterplayer.php");
require_once($DOC_ROOT . "/lib/classes/offl_playerstat.php");
require_once($DOC_ROOT . "/lib/classes/offl_pastroster.php");

$fix = new OFFL_DBObject();

// UPGRADE TO OFFL 0.2.3

// Add new fields to database table `games`
$fix->SQLQuery("ALTER TABLE `games` ADD `description` VARCHAR(100) AFTER `final`");
$fix->SQLQuery("ALTER TABLE `games` ADD `playoff` TINYINT UNSIGNED DEFAULT 0 AFTER `description`");
$fix->SQLQuery("ALTER TABLE `games` ADD `playoff_vteam` VARCHAR(10) AFTER `playoff`");
$fix->SQLQuery("ALTER TABLE `games` ADD `playoff_hteam` VARCHAR(10) AFTER `playoff_vteam`");
echo "<p>Games database updated successfully.</p>\n";

$fix->SQLQuery("drop table if exists `leadpipelock`");
$fix->SQLQuery("create table `leadpipelock` (`user_id` smallint unsigned not null, `league_id` smallint unsigned not null, `year` smallint unsigned not null, `week` tinyint unsigned not null, `nflteam_id` tinyint unsigned not null, `correct` tinyint(1) unsigned DEFAULT 0, primary key (`user_id`, `league_id`, `year`, `week`))");

$fix->SQLQuery("drop table if exists `pastleagues`");
$fix->SQLQuery("CREATE TABLE `pastleagues` ( `league_id` SMALLINT unsigned NOT NULL, `year` SMALLINT unsigned NOT NULL, `division_id_array` VARCHAR(100), `fflteam_id_array` VARCHAR(200), `user_id_array` VARCHAR(200), PRIMARY KEY ( `league_id`, `year` ))");
echo "<p>New databases created successfully.</p>\n";

$fix->SQLQuery("insert into `control` (`control_key`,`control_value`,`control_desc`,`control_allowed_values`) values ('MISC_LPL_ENABLE','No','Enable the Lead Pipe Lock pick-em minigame','Yes,No')");
$fix->SQLQuery("insert into `control` (`control_key`,`control_value`,`control_desc`,`control_allowed_values`) values ('MISC_LPL_ELIMINATION','Elimination','Set the Lead Pipe Lock pick-em minigame to single-fail elimination or season-long total','Elimination,Season Total')");
echo "<p>New control keys created successfully.</p>\n";

echo "<p>Upgrade to OFFL v";
include($DOC_ROOT . "/lib/VERSION");
echo " successful.</p>\n";

exit();

?>
Return current item: Online Fantasy Football League