SAAS-1073: Schema upgrade for podcasts

Upgrade and downgrade done.
This commit is contained in:
drigato 2015-11-03 10:57:55 -05:00
parent def8e7280b
commit d20574dfb1
4 changed files with 113 additions and 1 deletions

View File

@ -32,7 +32,7 @@ define('AIRTIME_COPYRIGHT_DATE' , '2010-2015');
define('AIRTIME_REST_VERSION' , '1.1');
define('AIRTIME_API_VERSION' , '1.1');
// XXX: it's important that we upgrade this every time we add an upgrade!
define('AIRTIME_CODE_VERSION' , '2.5.14');
define('AIRTIME_CODE_VERSION' , '2.5.15');
// Defaults
define('DEFAULT_LOGO_PLACEHOLDER', 1);

View File

@ -0,0 +1,9 @@
ALTER TABLE cc_files DROP COLUMN description;
DROP TABLE IF EXISTS "podcast" CASCADE;
DROP TABLE IF EXISTS "imported_podcast" CASCADE;
DROP TABLE IF EXISTS "station_podcast" CASCADE;
DROP TABLE IF EXISTS "podcast_episodes" CASCADE;

View File

@ -0,0 +1,90 @@
ALTER TABLE cc_files ADD COLUMN description VARCHAR(512);
-----------------------------------------------------------------------
-- podcast
-----------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS "podcast"
(
"id" serial NOT NULL,
"url" VARCHAR(4096) NOT NULL,
"title" VARCHAR(4096) NOT NULL,
"creator" VARCHAR(4096),
"description" VARCHAR(4096),
"language" VARCHAR(4096),
"copyright" VARCHAR(4096),
"link" VARCHAR(4096),
"itunes_author" VARCHAR(4096),
"itunes_keywords" VARCHAR(4096),
"itunes_summary" VARCHAR(4096),
"itunes_subtitle" VARCHAR(4096),
"itunes_category" VARCHAR(4096),
"itunes_explicit" VARCHAR(4096),
"owner" INTEGER,
PRIMARY KEY ("id")
);
-----------------------------------------------------------------------
-- station_podcast
-----------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS "station_podcast"
(
"id" serial NOT NULL,
"podcast_id" INTEGER NOT NULL,
PRIMARY KEY ("id")
);
-----------------------------------------------------------------------
-- imported_podcast
-----------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS "imported_podcast"
(
"id" serial NOT NULL,
"auto_ingest" BOOLEAN DEFAULT 'f' NOT NULL,
"auto_ingest_timestamp" TIMESTAMP,
"podcast_id" INTEGER NOT NULL,
PRIMARY KEY ("id")
);
-----------------------------------------------------------------------
-- podcast_episodes
-----------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS "podcast_episodes"
(
"id" serial NOT NULL,
"file_id" INTEGER,
"podcast_id" INTEGER NOT NULL,
"publication_date" TIMESTAMP NOT NULL,
"download_url" VARCHAR(4096) NOT NULL,
"episode_guid" VARCHAR(4096) NOT NULL,
PRIMARY KEY ("id")
);
ALTER TABLE "podcast" ADD CONSTRAINT "podcast_owner_fkey"
FOREIGN KEY ("owner")
REFERENCES "cc_subjs" ("id")
ON DELETE CASCADE;
ALTER TABLE "station_podcast" ADD CONSTRAINT "podcast_id_fkey"
FOREIGN KEY ("podcast_id")
REFERENCES "podcast" ("id")
ON DELETE CASCADE;
ALTER TABLE "imported_podcast" ADD CONSTRAINT "podcast_id_fkey"
FOREIGN KEY ("podcast_id")
REFERENCES "podcast" ("id")
ON DELETE CASCADE;
ALTER TABLE "podcast_episodes" ADD CONSTRAINT "podcast_episodes_cc_files_fkey"
FOREIGN KEY ("file_id")
REFERENCES "cc_files" ("id")
ON DELETE CASCADE;
ALTER TABLE "podcast_episodes" ADD CONSTRAINT "podcast_episodes_podcast_id_fkey"
FOREIGN KEY ("podcast_id")
REFERENCES "podcast" ("id")
ON DELETE CASCADE;

View File

@ -493,3 +493,16 @@ class AirtimeUpgrader2515 extends AirtimeUpgrader
return '2.5.15';
}
}
class AirtimeUpgrader2516 extends AirtimeUpgrader
{
protected function getSupportedSchemaVersions() {
return array(
'2.5.15'
);
}
public function getNewVersion() {
return '2.5.16';
}
}