From cc1fddb0372d3a05769aad75819702e122776eea Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Tue, 10 Apr 2012 12:13:58 +0200 Subject: [PATCH] CC-3605 : Create 2.1 upgrades --- .../upgrades/airtime-2.1.0/DbUpgrade.php | 2 +- .../common/Version20120410104441.php | 26 +++++++++++++++---- .../common/Version20120410115311.php | 20 -------------- 3 files changed, 22 insertions(+), 26 deletions(-) delete mode 100644 install_minimal/upgrades/airtime-2.1.0/common/Version20120410115311.php diff --git a/install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php b/install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php index 0bbba5a4a..7d306ab06 100644 --- a/install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php +++ b/install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php @@ -11,7 +11,7 @@ class AirtimeDatabaseUpgrade{ } private static function task0(){ - UpgradeCommon::MigrateTablesToVersion(__DIR__, '20120410115311'); + UpgradeCommon::MigrateTablesToVersion(__DIR__, '20120410104441'); $sql = "INSERT INTO cc_pref(\"keystr\", \"valstr\") VALUES('scheduled_play_switch', 'on')"; UpgradeCommon::nonSelectQueryDb($sql); } 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 8254d79ad..a099a174d 100644 --- a/install_minimal/upgrades/airtime-2.1.0/common/Version20120410104441.php +++ b/install_minimal/upgrades/airtime-2.1.0/common/Version20120410104441.php @@ -7,14 +7,30 @@ use Doctrine\DBAL\Migrations\AbstractMigration, class Version20120410104441 extends AbstractMigration { + public function preUp(Schema $schema) + { + //start changes to cc_files + //add temp columns for changing bitrate and sample rate to integers. + $cc_files = $schema->getTable('cc_files'); + $cc_files->addColumn('temp_br', 'integer', array('notnull' => 0)); + $cc_files->addColumn('temp_sr', 'integer', array('notnull' => 0)); + //end changes to cc_files + } + public function up(Schema $schema) { - //start changes to cc_files + $this->_addSql("UPDATE cc_files SET temp_br = bit_rate::integer"); + $this->_addSql("UPDATE cc_files SET temp_sr = sample_rate::integer"); + } + + public function postUp(Schema $schema) + { $cc_files = $schema->getTable('cc_files'); - $cc_files->addColumn('temp_br', 'integer', array('notnull' => 0)); - $cc_files->addColumn('temp_sr', 'integer', array('notnull' => 0)); - - //end changes to cc_files + $cc_files->dropColumn('bit_rate'); + $cc_files->dropColumn('sample_rate'); + + $cc_files->renameColumn('temp_br', 'bit_rate'); + $cc_files->renameColumn('temp_sr', 'sample_rate'); } public function down(Schema $schema) diff --git a/install_minimal/upgrades/airtime-2.1.0/common/Version20120410115311.php b/install_minimal/upgrades/airtime-2.1.0/common/Version20120410115311.php deleted file mode 100644 index aefadbff7..000000000 --- a/install_minimal/upgrades/airtime-2.1.0/common/Version20120410115311.php +++ /dev/null @@ -1,20 +0,0 @@ -_addSql("UPDATE cc_files SET temp_br = bit_rate::integer"); - $this->_addSql("UPDATE cc_files SET temp_sr = sample_rate::integer"); - } - - public function down(Schema $schema) - { - - } -} \ No newline at end of file