From 90b7235e3de67bc1e10d32b0a54f168608fb5648 Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Tue, 10 Apr 2012 18:32:10 +0200 Subject: [PATCH] CC-3605 : Create 2.1 upgrades --- .../airtime-2.1.0/common/Version20120410143340.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/install_minimal/upgrades/airtime-2.1.0/common/Version20120410143340.php b/install_minimal/upgrades/airtime-2.1.0/common/Version20120410143340.php index dc320edbe..3fc56b850 100644 --- a/install_minimal/upgrades/airtime-2.1.0/common/Version20120410143340.php +++ b/install_minimal/upgrades/airtime-2.1.0/common/Version20120410143340.php @@ -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)