diff --git a/airtime_mvc/application/configs/constants.php b/airtime_mvc/application/configs/constants.php index b99423fd3..e15794bdb 100644 --- a/airtime_mvc/application/configs/constants.php +++ b/airtime_mvc/application/configs/constants.php @@ -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); diff --git a/airtime_mvc/application/controllers/downgrade_sql/airtime_2.5.16/downgrade.sql b/airtime_mvc/application/controllers/downgrade_sql/airtime_2.5.16/downgrade.sql new file mode 100644 index 000000000..b540e0276 --- /dev/null +++ b/airtime_mvc/application/controllers/downgrade_sql/airtime_2.5.16/downgrade.sql @@ -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; diff --git a/airtime_mvc/application/controllers/upgrade_sql/airtime_2.5.16/upgrade.sql b/airtime_mvc/application/controllers/upgrade_sql/airtime_2.5.16/upgrade.sql new file mode 100644 index 000000000..ff1806ca6 --- /dev/null +++ b/airtime_mvc/application/controllers/upgrade_sql/airtime_2.5.16/upgrade.sql @@ -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; diff --git a/airtime_mvc/application/upgrade/Upgrades.php b/airtime_mvc/application/upgrade/Upgrades.php index b428cd093..d1ac02ce5 100644 --- a/airtime_mvc/application/upgrade/Upgrades.php +++ b/airtime_mvc/application/upgrade/Upgrades.php @@ -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'; + } +}