Add downgrade action to UpgradeController, fix SoundCloud schema and bugs

This commit is contained in:
Duncan Sommerville 2015-06-24 18:38:04 -04:00
parent 8fcaf7fc74
commit 67155b136a
14 changed files with 361 additions and 93 deletions

View file

@ -33,4 +33,35 @@ class UpgradeController extends Zend_Controller_Action
->appendBody($e->getMessage());
}
}
public function downgradeAction() {
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
if (!RestAuth::verifyAuth(true, false, $this)) {
return;
}
$request = $this->getRequest();
$toVersion = $request->getParam("version");
try {
$downgradePerformed = UpgradeManager::doDowngrade($toVersion);
if (!$downgradePerformed) {
$this->getResponse()
->setHttpResponseCode(200)
->appendBody("No downgrade was performed. The current schema version is " . Application_Model_Preference::GetSchemaVersion() . ".<br>");
} else {
$this->getResponse()
->setHttpResponseCode(200)
->appendBody("Downgrade to Airtime schema version " . Application_Model_Preference::GetSchemaVersion() . " OK<br>");
}
} catch (Exception $e) {
$this->getResponse()
->setHttpResponseCode(400)
->appendBody($e->getMessage());
}
}
}

View file

@ -0,0 +1,11 @@
-----------------------------------------------------------------------
-- third_party_track_references
-----------------------------------------------------------------------
DROP TABLE IF EXISTS "third_party_track_references" CASCADE;
-----------------------------------------------------------------------
-- celery_tasks
-----------------------------------------------------------------------
DROP TABLE IF EXISTS "celery_tasks" CASCADE;

View file

@ -20,7 +20,8 @@ CREATE TABLE IF NOT EXISTS "third_party_track_references"
CREATE TABLE IF NOT EXISTS "celery_tasks"
(
"id" VARCHAR(256) NOT NULL,
"id" serial NOT NULL,
"task_id" VARCHAR(256) NOT NULL,
"track_reference" INTEGER NOT NULL,
"name" VARCHAR(256),
"dispatch_time" TIMESTAMP,