CC-3605 : Create 2.1 upgrades

This commit is contained in:
Naomi Aro 2012-04-10 18:32:10 +02:00
parent 91b4365f08
commit 90b7235e3d

View file

@ -18,6 +18,18 @@ class Version20120410143340 extends AbstractMigration
$this->_addSql("ALTER TABLE cc_playlist ADD CONSTRAINT cc_playlist_createdby_fkey FOREIGN KEY (creator_id) REFERENCES cc_subjs(id) NOT DEFERRABLE INITIALLY IMMEDIATE");
$this->_addSql("ALTER TABLE cc_playlist ADD utime timestamp(6)");
//set the initial created to modified time since this is the closest we can get to inital creation time.
$this->_addSql("UPDATE cc_playlist SET utime = mtime");
$this->_addSql("ALTER TABLE cc_playlist ADD length interval default '00:00:00'");
//copy length property from our old view cc_playlisttimes
$this->_addSql("UPDATE cc_playlist AS pl SET length = (SELECT pt.length FROM cc_playlisttimes AS pt WHERE pt.id = pl.id)");
//drop the view as it is no longer needed.
$this->_addSql("DROP cc_playlisttimes");
$this->_addSql("ALTER TABLE cc_playlist DROP COLUMN state");
$this->_addSql("ALTER TABLE cc_playlist DROP COLUMN currentlyaccessing");
$this->_addSql("ALTER TABLE cc_playlist DROP COLUMN editedby");
}
public function down(Schema $schema)