CC-3605 : Create 2.1 upgrades
This commit is contained in:
parent
baaeae0890
commit
ef9fd0d757
3 changed files with 13 additions and 32 deletions
|
@ -11,7 +11,7 @@ class AirtimeDatabaseUpgrade{
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function task0(){
|
private static function task0(){
|
||||||
UpgradeCommon::MigrateTablesToVersion(__DIR__, '20120410134819');
|
UpgradeCommon::MigrateTablesToVersion(__DIR__, '20120410104441');
|
||||||
$sql = "INSERT INTO cc_pref(\"keystr\", \"valstr\") VALUES('scheduled_play_switch', 'on')";
|
$sql = "INSERT INTO cc_pref(\"keystr\", \"valstr\") VALUES('scheduled_play_switch', 'on')";
|
||||||
UpgradeCommon::nonSelectQueryDb($sql);
|
UpgradeCommon::nonSelectQueryDb($sql);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,17 @@ class Version20120410104441 extends AbstractMigration
|
||||||
public function up(Schema $schema)
|
public function up(Schema $schema)
|
||||||
{
|
{
|
||||||
//add temp columns for changing bitrate and sample rate to integers.
|
//add temp columns for changing bitrate and sample rate to integers.
|
||||||
$cc_files = $schema->getTable('cc_files');
|
$this->_addSql("ALTER TABLE cc_files ADD temp_br integer");
|
||||||
$cc_files->addColumn('temp_br', 'integer', array('notnull' => 0));
|
$this->_addSql("ALTER TABLE cc_files ADD temp_sr integer");
|
||||||
$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");
|
||||||
|
|
||||||
|
$this->_addSql("ALTER TABLE cc_files DROP COLUMN sample_rate");
|
||||||
|
$this->_addSql("ALTER TABLE cc_files DROP COLUMN bit_rate");
|
||||||
|
|
||||||
|
$this->_addSql("ALTER TABLE cc_files RENAME COLUMN temp_sr TO sample_rate");
|
||||||
|
$this->_addSql("ALTER TABLE cc_files RENAME COLUMN temp_br TO bit_rate");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function down(Schema $schema)
|
public function down(Schema $schema)
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
<?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)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue