CC-3605 : Create 2.1 upgrades
This commit is contained in:
parent
cc1fddb037
commit
222aad08e7
|
@ -7,32 +7,24 @@ use Doctrine\DBAL\Migrations\AbstractMigration,
|
||||||
|
|
||||||
class Version20120410104441 extends AbstractMigration
|
class Version20120410104441 extends AbstractMigration
|
||||||
{
|
{
|
||||||
public function preUp(Schema $schema)
|
public function up(Schema $schema)
|
||||||
{
|
{
|
||||||
//start changes to cc_files
|
|
||||||
//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');
|
$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));
|
$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)
|
$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 = $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');
|
$cc_files->renameColumn('temp_sr', 'sample_rate');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function down(Schema $schema)
|
public function down(Schema $schema)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue