CC-3422: Upgrade Script: add/enhance upgrade script for relay stream feature

- done
This commit is contained in:
James 2012-04-03 14:59:52 -04:00
parent 1de7ffcd3f
commit 6943120fc6
3 changed files with 19 additions and 5 deletions

View file

@ -11,7 +11,9 @@ class AirtimeDatabaseUpgrade{
} }
private static function task0(){ private static function task0(){
UpgradeCommon::MigrateTablesToVersion(__DIR__, '20120402103944'); UpgradeCommon::MigrateTablesToVersion(__DIR__, '20120403143635');
$sql = "INSERT INTO cc_pref(\"keystr\", \"valstr\") VALUES('scheduled_play_switch', 'on')";
UpgradeCommon::nonSelectQueryDb($sql);
} }
} }

View file

@ -21,7 +21,7 @@ class UpgradeCommon{
{ {
$sql = "SELECT valstr from cc_pref WHERE keystr = 'timezone'"; $sql = "SELECT valstr from cc_pref WHERE keystr = 'timezone'";
$result = self::queryDb($sql); $result = self::selectQueryDb($sql);
$timezone = $result['valstr']; $timezone = $result['valstr'];
date_default_timezone_set($timezone); date_default_timezone_set($timezone);
@ -238,7 +238,7 @@ class UpgradeCommon{
fclose($fp); fclose($fp);
} }
public static function queryDb($p_sql){ public static function selectQueryDb($p_sql){
global $CC_DBC; global $CC_DBC;
$result = $CC_DBC->getRow($p_sql, $fetchmode=DB_FETCHMODE_ASSOC); $result = $CC_DBC->getRow($p_sql, $fetchmode=DB_FETCHMODE_ASSOC);
@ -249,4 +249,16 @@ class UpgradeCommon{
return $result; return $result;
} }
public static function nonSelectQueryDb($p_sql){
global $CC_DBC;
$result = $CC_DBC->query($p_sql);
if (PEAR::isError($result)) {
echo "Error executing $sql. Exiting.";
exit(1);
}
return $result;
}
} }

View file

@ -12,8 +12,8 @@ class Version20120403143635 extends AbstractMigration
$cc_show = $schema->getTable('cc_show'); $cc_show = $schema->getTable('cc_show');
$cc_show->addColumn('live_stream_using_airtime_auth', 'boolean', array('default'=> 'false')); $cc_show->addColumn('live_stream_using_airtime_auth', 'boolean', array('default'=> 'false'));
$cc_show->addColumn('live_stream_using_custom_auth', 'boolean', array('default'=> 'false')); $cc_show->addColumn('live_stream_using_custom_auth', 'boolean', array('default'=> 'false'));
$cc_show->addColumn('live_stream_user', 'string', array('length' => 255)); $cc_show->addColumn('live_stream_user', 'string', array('notnull' => 0, 'length' => 255));
$cc_show->addColumn('live_stream_pass', 'string', array('length' => 255)); $cc_show->addColumn('live_stream_pass', 'string', array('notnull' => 0, 'length' => 255));
} }
public function down(Schema $schema) public function down(Schema $schema)