CC-3605 : Create 2.1 upgrades
This commit is contained in:
parent
1003920815
commit
cc1fddb037
3 changed files with 22 additions and 26 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -7,16 +7,32 @@ use Doctrine\DBAL\Migrations\AbstractMigration,
|
|||
|
||||
class Version20120410104441 extends AbstractMigration
|
||||
{
|
||||
public function up(Schema $schema)
|
||||
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)
|
||||
{
|
||||
$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->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)
|
||||
{
|
||||
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Migrations\AbstractMigration,
|
||||
Doctrine\DBAL\Schema\Schema;
|
||||
|
||||
class Version20120410115311 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");
|
||||
}
|
||||
|
||||
public function down(Schema $schema)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue