Merge branch 'CC-3174' into devel
This commit is contained in:
commit
e1291c9939
|
@ -8,12 +8,48 @@ class AirtimeDatabaseUpgrade{
|
|||
public static function start(){
|
||||
echo "* Updating Database".PHP_EOL;
|
||||
self::task0();
|
||||
self::task1();
|
||||
}
|
||||
|
||||
private static function task0(){
|
||||
UpgradeCommon::MigrateTablesToVersion(__DIR__, '20120410143340');
|
||||
UpgradeCommon::MigrateTablesToVersion(__DIR__, '20120411174904');
|
||||
|
||||
$sql = "INSERT INTO cc_pref(\"keystr\", \"valstr\") VALUES('scheduled_play_switch', 'on')";
|
||||
UpgradeCommon::nonSelectQueryDb($sql);
|
||||
}
|
||||
|
||||
/*
|
||||
* set values for playout_status in cc_schedule
|
||||
*/
|
||||
private static function task1() {
|
||||
|
||||
// Define path to application directory
|
||||
defined('APPLICATION_PATH')
|
||||
|| define('APPLICATION_PATH', realpath(__DIR__.'/../../../airtime_mvc/application'));
|
||||
|
||||
// Ensure library is on include_path
|
||||
set_include_path(implode(PATH_SEPARATOR, array(
|
||||
get_include_path(),
|
||||
realpath(APPLICATION_PATH . '/../library')
|
||||
)));
|
||||
|
||||
//Propel classes.
|
||||
set_include_path(APPLICATION_PATH . '/models' . PATH_SEPARATOR . get_include_path());
|
||||
|
||||
//include_once APPLICATION_PATH."/configs/conf.php";
|
||||
include_once 'propel/runtime/lib/Propel.php';
|
||||
Propel::init(APPLICATION_PATH."/configs/airtime-conf-production.php");
|
||||
|
||||
$con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
|
||||
|
||||
$showInstances = CcShowInstancesQuery::create()
|
||||
->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)
|
||||
->filterByDbStarts(gmdate("Y-m-d H:i:s"), Criteria::GREATER_EQUAL)
|
||||
->find($con);
|
||||
|
||||
foreach ($showInstances as $instance) {
|
||||
$instance->updateScheduleStatus($con);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,6 +28,10 @@ class Version20120410104441 extends AbstractMigration
|
|||
//add utime, lptime
|
||||
$this->_addSql("ALTER TABLE cc_files ADD utime timestamp(6)");
|
||||
$this->_addSql("ALTER TABLE cc_files ADD lptime timestamp(6)");
|
||||
|
||||
//setting these to a default now for timeline refresh purposes.
|
||||
$now = gmdate("Y-m-d H:i:s");
|
||||
$this->_addSql("UPDATE cc_files SET utime = '$now'");
|
||||
}
|
||||
|
||||
public function down(Schema $schema)
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Migrations\AbstractMigration,
|
||||
Doctrine\DBAL\Schema\Schema;
|
||||
|
||||
class Version20120411102907 extends AbstractMigration
|
||||
{
|
||||
/*
|
||||
* changing many columns from time without timezone to interval
|
||||
*
|
||||
* altering cc_schedule for 2.1
|
||||
*/
|
||||
public function up(Schema $schema)
|
||||
{
|
||||
$this->_addSql("ALTER TABLE cc_files ALTER COLUMN length TYPE interval");
|
||||
|
||||
$this->_addSql("ALTER TABLE cc_playlistcontents ALTER COLUMN cuein TYPE interval");
|
||||
$this->_addSql("ALTER TABLE cc_playlistcontents ALTER COLUMN cueout TYPE interval");
|
||||
$this->_addSql("ALTER TABLE cc_playlistcontents ALTER COLUMN cliplength TYPE interval");
|
||||
|
||||
$this->_addSql("ALTER TABLE cc_schedule ALTER COLUMN cue_in TYPE interval");
|
||||
$this->_addSql("ALTER TABLE cc_schedule ALTER COLUMN cue_out TYPE interval");
|
||||
$this->_addSql("ALTER TABLE cc_schedule ALTER COLUMN clip_length TYPE interval");
|
||||
|
||||
$this->_addSql("ALTER TABLE cc_show_instances ALTER COLUMN time_filled TYPE interval");
|
||||
|
||||
//remove old columns from cc_schedule that deal with groups or playlists.
|
||||
$this->_addSql("ALTER TABLE cc_schedule DROP COLUMN group_id");
|
||||
$this->_addSql("ALTER TABLE cc_schedule DROP COLUMN schedule_group_played");
|
||||
$this->_addSql("ALTER TABLE cc_schedule DROP COLUMN playlist_id");
|
||||
|
||||
$this->_addSql("ALTER TABLE cc_schedule ADD playout_status integer DEFAULT 1 NOT NULL");
|
||||
}
|
||||
|
||||
public function down(Schema $schema)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Migrations\AbstractMigration,
|
||||
Doctrine\DBAL\Schema\Schema;
|
||||
|
||||
class Version20120411174904 extends AbstractMigration
|
||||
{
|
||||
/*
|
||||
* modifications to cc_show_instances for 2.1
|
||||
*/
|
||||
public function up(Schema $schema)
|
||||
{
|
||||
$this->_addSql("ALTER TABLE cc_show_instances ADD created timestamp(6)");
|
||||
$this->_addSql("ALTER TABLE cc_show_instances ADD last_scheduled timestamp(6)");
|
||||
|
||||
//setting these to a default now for timeline refresh purposes.
|
||||
$now = gmdate("Y-m-d H:i:s");
|
||||
$this->_addSql("UPDATE cc_show_instances SET created = '$now'");
|
||||
$this->_addSql("UPDATE cc_show_instances SET last_scheduled = '$now'");
|
||||
}
|
||||
|
||||
public function down(Schema $schema)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue