testing if the column has wrong type, if so replacing it.
This commit is contained in:
parent
df70185ae6
commit
908aa890fe
|
@ -15,12 +15,15 @@ class Version20110406182005 extends AbstractMigration
|
||||||
$cc_show_instances->addColumn('time_filled', 'time', array('notnull' => false));
|
$cc_show_instances->addColumn('time_filled', 'time', array('notnull' => false));
|
||||||
//end cc_show_instances modifications
|
//end cc_show_instances modifications
|
||||||
|
|
||||||
//start cc_show_instances modifications
|
//start cc_show_rebroadcast modifications
|
||||||
$cc_show_rebroadcast = $schema->getTable('cc_show_rebroadcast');
|
$cc_show_rebroadcast = $schema->getTable('cc_show_rebroadcast');
|
||||||
$cc_show_rebroadcast->dropColumn('start_time');
|
|
||||||
$cc_show_rebroadcast->addColumn('start_time', 'time', array('notnull' => true));
|
|
||||||
//end cc_show_instances modifications
|
|
||||||
|
|
||||||
|
$type = $cc_show_rebroadcast->getColumn('start_time')->getType()->getName();
|
||||||
|
if($type == 'datetime') {
|
||||||
|
$cc_show_rebroadcast->dropColumn('start_time');
|
||||||
|
$cc_show_rebroadcast->addColumn('start_time', 'time', array('notnull' => true));
|
||||||
|
}
|
||||||
|
//end cc_show_rebroadcast modifications
|
||||||
}
|
}
|
||||||
|
|
||||||
public function down(Schema $schema)
|
public function down(Schema $schema)
|
||||||
|
@ -31,10 +34,14 @@ class Version20110406182005 extends AbstractMigration
|
||||||
$cc_show_instances->dropColumn('time_filled');
|
$cc_show_instances->dropColumn('time_filled');
|
||||||
//end cc_show_instances modifications
|
//end cc_show_instances modifications
|
||||||
|
|
||||||
//start cc_show_instances modifications
|
//start cc_show_rebroadcast modifications
|
||||||
$cc_show_rebroadcast = $schema->getTable('cc_show_rebroadcast');
|
$cc_show_rebroadcast = $schema->getTable('cc_show_rebroadcast');
|
||||||
$cc_show_rebroadcast->dropColumn('start_time');
|
|
||||||
$cc_show_rebroadcast->addColumn('start_time', 'datetime', array('notnull' => 1));
|
$type = $cc_show_rebroadcast->getColumn('start_time')->getType()->getName();
|
||||||
//end cc_show_instances modifications
|
if($type == 'datetime') {
|
||||||
|
$cc_show_rebroadcast->dropColumn('start_time');
|
||||||
|
$cc_show_rebroadcast->addColumn('start_time', 'datetime', array('notnull' => 1));
|
||||||
|
}
|
||||||
|
//end cc_show_rebroadcast modifications
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue