CC-3732: NationTalk Database upgrade fail, from 2.0.3 to 2.1.0

-move NOT NULL constraint to after the column has been populated
This commit is contained in:
Martin Konecny 2012-05-04 17:37:30 -04:00
parent 4d7d17fe55
commit 495ad63333

View file

@ -13,18 +13,18 @@ class Version20120411174904 extends AbstractMigration
public function up(Schema $schema)
{
$this->_addSql("ALTER TABLE cc_show_instances ADD created timestamp");
$this->_addSql("ALTER TABLE cc_show_instances ALTER COLUMN created SET NOT NULL");
$this->_addSql("ALTER TABLE cc_show_instances ADD last_scheduled timestamp");
//setting these to a default now for timeline refresh purposes.
$now = gmdate("Y-m-d H:i:s");
$this->_addSql("UPDATE cc_show_instances SET created = '$now'");
$this->_addSql("UPDATE cc_show_instances SET last_scheduled = '$now'");
$this->_addSql("ALTER TABLE cc_show_instances ALTER COLUMN created SET NOT NULL");
}
public function down(Schema $schema)
{
}
}
}