From cc806d9b7b854e554399e2716fd8f15e491e23ed Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Wed, 11 Apr 2012 11:18:28 +0200 Subject: [PATCH 1/8] CC-3605 : Create 2.1 upgrades --- .../common/Version20120411102907.php | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 install_minimal/upgrades/airtime-2.1.0/common/Version20120411102907.php diff --git a/install_minimal/upgrades/airtime-2.1.0/common/Version20120411102907.php b/install_minimal/upgrades/airtime-2.1.0/common/Version20120411102907.php new file mode 100644 index 000000000..8811990e1 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.1.0/common/Version20120411102907.php @@ -0,0 +1,39 @@ +_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"); + + //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) + { + + } +} \ No newline at end of file From bcc30b9cb1cb9405b49c7b7b99f998472239ffb8 Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Wed, 11 Apr 2012 16:01:04 +0200 Subject: [PATCH 2/8] CC-3605 : Create 2.1 upgrades --- .../upgrades/airtime-2.1.0/DbUpgrade.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php b/install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php index ed4ac9089..08935b8b3 100644 --- a/install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php +++ b/install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php @@ -12,8 +12,23 @@ class AirtimeDatabaseUpgrade{ private static function task0(){ UpgradeCommon::MigrateTablesToVersion(__DIR__, '20120410143340'); + $sql = "INSERT INTO cc_pref(\"keystr\", \"valstr\") VALUES('scheduled_play_switch', 'on')"; UpgradeCommon::nonSelectQueryDb($sql); + + require_once 'propel/runtime/lib/Propel.php'; + Propel::init(__DIR__."/../../configs/airtime-conf-production.php"); + + $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME); + + $showInstances = CcShowInstancesQuery::create() + ->setFormatter(ModelCriteria::FORMAT_ON_DEMAND) + ->filterByDbStarts(Criteria::GREATER_EQUAL) + ->find($con); + + foreach ($showInstances as $instance) { + $instance->updateScheduleStatus($con); + } } } From c2ce50bf46ca5e89822c8206e199fd0425c70683 Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Wed, 11 Apr 2012 16:27:46 +0200 Subject: [PATCH 3/8] CC-3605 : Create 2.1 upgrades --- .../upgrades/airtime-2.1.0/DbUpgrade.php | 44 ++++++++++++++----- 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php b/install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php index 08935b8b3..a59510858 100644 --- a/install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php +++ b/install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php @@ -8,26 +8,46 @@ 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__, '20120411102907'); $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__."/../../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()); require_once 'propel/runtime/lib/Propel.php'; - Propel::init(__DIR__."/../../configs/airtime-conf-production.php"); - - $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME); - - $showInstances = CcShowInstancesQuery::create() - ->setFormatter(ModelCriteria::FORMAT_ON_DEMAND) - ->filterByDbStarts(Criteria::GREATER_EQUAL) - ->find($con); - - foreach ($showInstances as $instance) { - $instance->updateScheduleStatus($con); + Propel::init(APPLICATION_PATH."/configs/airtime-conf-production.php"); + + $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME); + + $showInstances = CcShowInstancesQuery::create() + ->setFormatter(ModelCriteria::FORMAT_ON_DEMAND) + ->filterByDbStarts(Criteria::GREATER_EQUAL) + ->find($con); + + foreach ($showInstances as $instance) { + $instance->updateScheduleStatus($con); } } From 08162de842949fded9a782729fc5be684b07b1b9 Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Wed, 11 Apr 2012 17:57:14 +0200 Subject: [PATCH 4/8] CC-3605 : Create 2.1 upgrades --- .../upgrades/airtime-2.1.0/DbUpgrade.php | 7 +++--- .../common/Version20120411174904.php | 23 +++++++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 install_minimal/upgrades/airtime-2.1.0/common/Version20120411174904.php diff --git a/install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php b/install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php index a59510858..509beb5a1 100644 --- a/install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php +++ b/install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php @@ -12,7 +12,7 @@ class AirtimeDatabaseUpgrade{ } private static function task0(){ - UpgradeCommon::MigrateTablesToVersion(__DIR__, '20120411102907'); + UpgradeCommon::MigrateTablesToVersion(__DIR__, '20120411174904'); $sql = "INSERT INTO cc_pref(\"keystr\", \"valstr\") VALUES('scheduled_play_switch', 'on')"; UpgradeCommon::nonSelectQueryDb($sql); @@ -25,7 +25,7 @@ class AirtimeDatabaseUpgrade{ // Define path to application directory defined('APPLICATION_PATH') - || define('APPLICATION_PATH', realpath(__DIR__."/../../application")); + || define('APPLICATION_PATH', realpath(__DIR__.'/../../../airtime_mvc/application')); // Ensure library is on include_path set_include_path(implode(PATH_SEPARATOR, array( @@ -36,6 +36,7 @@ class AirtimeDatabaseUpgrade{ //Propel classes. set_include_path(APPLICATION_PATH . '/models' . PATH_SEPARATOR . get_include_path()); + require_once APPLICATION_PATH."/configs/conf.php"; require_once 'propel/runtime/lib/Propel.php'; Propel::init(APPLICATION_PATH."/configs/airtime-conf-production.php"); @@ -43,7 +44,7 @@ class AirtimeDatabaseUpgrade{ $showInstances = CcShowInstancesQuery::create() ->setFormatter(ModelCriteria::FORMAT_ON_DEMAND) - ->filterByDbStarts(Criteria::GREATER_EQUAL) + ->filterByDbStarts(gmdate("Y-m-d H:i:s"), Criteria::GREATER_EQUAL) ->find($con); foreach ($showInstances as $instance) { diff --git a/install_minimal/upgrades/airtime-2.1.0/common/Version20120411174904.php b/install_minimal/upgrades/airtime-2.1.0/common/Version20120411174904.php new file mode 100644 index 000000000..87f0f6714 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.1.0/common/Version20120411174904.php @@ -0,0 +1,23 @@ +_addSql("ALTER TABLE cc_show_instances ADD created timestamp(6)"); + $this->_addSql("ALTER TABLE cc_show_instances ADD last_scheduled timestamp(6)"); + } + + public function down(Schema $schema) + { + + } +} \ No newline at end of file From 37c929f6101b7412ea1fe172e3834f79b2dd3f42 Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Wed, 11 Apr 2012 18:16:20 +0200 Subject: [PATCH 5/8] CC-3605 : Create 2.1 upgrades --- .../upgrades/airtime-2.1.0/common/Version20120411102907.php | 2 ++ .../upgrades/airtime-2.1.0/common/Version20120411174904.php | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/install_minimal/upgrades/airtime-2.1.0/common/Version20120411102907.php b/install_minimal/upgrades/airtime-2.1.0/common/Version20120411102907.php index 8811990e1..3eee194f2 100644 --- a/install_minimal/upgrades/airtime-2.1.0/common/Version20120411102907.php +++ b/install_minimal/upgrades/airtime-2.1.0/common/Version20120411102907.php @@ -24,6 +24,8 @@ class Version20120411102907 extends AbstractMigration $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"); diff --git a/install_minimal/upgrades/airtime-2.1.0/common/Version20120411174904.php b/install_minimal/upgrades/airtime-2.1.0/common/Version20120411174904.php index 87f0f6714..8f8c1ba02 100644 --- a/install_minimal/upgrades/airtime-2.1.0/common/Version20120411174904.php +++ b/install_minimal/upgrades/airtime-2.1.0/common/Version20120411174904.php @@ -14,6 +14,11 @@ class Version20120411174904 extends AbstractMigration { $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) From d76dea2187b8d3f362144dc944cd5e17808881fb Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Wed, 11 Apr 2012 18:27:36 +0200 Subject: [PATCH 6/8] CC-3605 : Create 2.1 upgrades --- install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php b/install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php index 509beb5a1..b6d2d73db 100644 --- a/install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php +++ b/install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php @@ -36,8 +36,8 @@ class AirtimeDatabaseUpgrade{ //Propel classes. set_include_path(APPLICATION_PATH . '/models' . PATH_SEPARATOR . get_include_path()); - require_once APPLICATION_PATH."/configs/conf.php"; - require_once 'propel/runtime/lib/Propel.php'; + 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); From d4e0410b0e631fbdfe59a7c25ac27e01365a8cbf Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Wed, 11 Apr 2012 18:35:55 +0200 Subject: [PATCH 7/8] CC-3605 : Create 2.1 upgrades --- install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php b/install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php index b6d2d73db..f3b00b8d9 100644 --- a/install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php +++ b/install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php @@ -36,7 +36,7 @@ class AirtimeDatabaseUpgrade{ //Propel classes. set_include_path(APPLICATION_PATH . '/models' . PATH_SEPARATOR . get_include_path()); - include_once APPLICATION_PATH."/configs/conf.php"; + //include_once APPLICATION_PATH."/configs/conf.php"; include_once 'propel/runtime/lib/Propel.php'; Propel::init(APPLICATION_PATH."/configs/airtime-conf-production.php"); From 805454406f8f2e8c8e5b392c762cccde26a40dc2 Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Wed, 11 Apr 2012 18:37:57 +0200 Subject: [PATCH 8/8] CC-3605 : Create 2.1 upgrades --- .../upgrades/airtime-2.1.0/common/Version20120410104441.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/install_minimal/upgrades/airtime-2.1.0/common/Version20120410104441.php b/install_minimal/upgrades/airtime-2.1.0/common/Version20120410104441.php index 557796819..c41f7ef31 100644 --- a/install_minimal/upgrades/airtime-2.1.0/common/Version20120410104441.php +++ b/install_minimal/upgrades/airtime-2.1.0/common/Version20120410104441.php @@ -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)