CC-3605 : Create 2.1 upgrades

This commit is contained in:
Naomi Aro 2012-04-10 13:53:30 +02:00
parent 222aad08e7
commit baaeae0890
3 changed files with 29 additions and 12 deletions

View file

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

View file

@ -11,18 +11,8 @@ class Version20120410104441 extends AbstractMigration
{
//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_br', 'integer', array('notnull' => 0));
$cc_files->addColumn('temp_sr', 'integer', array('notnull' => 0));
$this->addSql("UPDATE cc_files SET temp_br = bit_rate::integer");
$this->addSql("UPDATE cc_files SET temp_sr = sample_rate::integer");
$cc_files = $schema->getTable('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)

View file

@ -0,0 +1,27 @@
<?php
namespace DoctrineMigrations;
use Doctrine\DBAL\Migrations\AbstractMigration,
Doctrine\DBAL\Schema\Schema;
class Version20120410134819 extends AbstractMigration
{
public function up(Schema $schema)
{
$this->_addSql("UPDATE cc_files SET temp_br = bit_rate::integer");
$this->_addSql("UPDATE cc_files SET temp_sr = sample_rate::integer");
$cc_files = $schema->getTable('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)
{
}
}