feat: replace php migration with django migration
- keep latest legacy version in initial migration file - move propel schema to api legacy app - remove legacy upgrade tool
This commit is contained in:
parent
ee98387264
commit
0e4bc4cacd
85 changed files with 1005 additions and 1000 deletions
|
@ -180,32 +180,6 @@ interface AirtimeTask
|
|||
public function run();
|
||||
}
|
||||
|
||||
/**
|
||||
* Class UpgradeTask.
|
||||
*
|
||||
* Checks the current Airtime version and runs any outstanding upgrades
|
||||
*/
|
||||
class UpgradeTask implements AirtimeTask
|
||||
{
|
||||
/**
|
||||
* Check the current Airtime schema version to see if an upgrade should be run.
|
||||
*
|
||||
* @return bool true if an upgrade is needed
|
||||
*/
|
||||
public function shouldBeRun()
|
||||
{
|
||||
return UpgradeManager::checkIfUpgradeIsNeeded();
|
||||
}
|
||||
|
||||
/**
|
||||
* Run all upgrades above the current schema version.
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
UpgradeManager::doUpgrade();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class CeleryTask.
|
||||
*
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
<?php
|
||||
|
||||
class UpgradeController extends Zend_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
if (!RestAuth::verifyAuth(true, false, $this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$didWePerformAnUpgrade = UpgradeManager::doUpgrade();
|
||||
|
||||
if (!$didWePerformAnUpgrade) {
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(200)
|
||||
->appendBody('No upgrade was performed. The current schema version is ' . Application_Model_Preference::GetSchemaVersion() . '.<br>');
|
||||
} else {
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(200)
|
||||
->appendBody('Upgrade to Airtime schema version ' . Application_Model_Preference::GetSchemaVersion() . ' OK<br>');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(400)
|
||||
->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());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
-----------------------------------------------------------------------
|
||||
-- third_party_track_references
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "third_party_track_references" CASCADE;
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- celery_tasks
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "celery_tasks" CASCADE;
|
|
@ -1 +0,0 @@
|
|||
ALTER TABLE third_party_track_references ALTER COLUMN file_id SET NOT NULL;
|
|
@ -1,11 +0,0 @@
|
|||
ALTER TABLE cc_files DROP COLUMN description;
|
||||
|
||||
DELETE FROM cc_pref WHERE keystr = 'station_podcast_id';
|
||||
|
||||
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;
|
|
@ -1,4 +0,0 @@
|
|||
ALTER TABLE imported_podcast DROP COLUMN IF EXISTS album_override;
|
||||
ALTER TABLE third_party_track_references ALTER COLUMN file_id DROP DEFAULT;
|
||||
ALTER TABLE third_party_track_references ALTER COLUMN file_id SET NOT NULL;
|
||||
ALTER TABLE cc_show DROP COLUMN IF EXISTS autoplaylist_repeat;
|
|
@ -1 +0,0 @@
|
|||
ALTER TABLE cc_service_register ALTER COLUMN ip TYPE character varying(18);
|
|
@ -1,2 +0,0 @@
|
|||
ALTER TABLE podcast_episodes DROP COLUMN IF EXISTS episode_title;
|
||||
ALTER TABLE podcast_episodes DROP COLUMN IF EXISTS episode_description;
|
|
@ -1 +0,0 @@
|
|||
ALTER TABLE cc_blockcriteria DROP COLUMN IF EXISTS criteriagroup;
|
|
@ -1 +0,0 @@
|
|||
ALTER TABLE podcast_episodes ALTER COLUMN episode_description TYPE VARCHAR(4096);
|
|
@ -1 +0,0 @@
|
|||
ALTER TABLE cc_block ALTER COLUMN type SET DEFAULT 'static';
|
|
@ -1 +0,0 @@
|
|||
ALTER TABLE cc_files DROP COLUMN IF EXISTS artwork;
|
|
@ -1,3 +0,0 @@
|
|||
ALTER TABLE cc_files DROP COLUMN IF EXISTS track_type;
|
||||
|
||||
DROP TABLE IF EXISTS "cc_track_types" CASCADE;
|
|
@ -1,10 +0,0 @@
|
|||
CREATE TABLE "cc_smemb"
|
||||
(
|
||||
"id" INTEGER NOT NULL,
|
||||
"uid" INTEGER DEFAULT 0 NOT NULL,
|
||||
"gid" INTEGER DEFAULT 0 NOT NULL,
|
||||
"level" INTEGER DEFAULT 0 NOT NULL,
|
||||
"mid" INTEGER,
|
||||
PRIMARY KEY ("id"),
|
||||
CONSTRAINT "cc_smemb_id_idx" UNIQUE ("id")
|
||||
);
|
|
@ -1,6 +0,0 @@
|
|||
-- we can restore the schema here but you'll need to restore data from a backup
|
||||
ALTER TABLE cc_files ADD COLUMN soundcloud_id INTEGER;
|
||||
ALTER TABLE cc_files ADD COLUMN soundcloud_error_code INTEGER;
|
||||
ALTER TABLE cc_files ADD COLUMN soundcloud_error_msg VARCHAR(512);
|
||||
ALTER TABLE cc_files ADD COLUMN soundcloud_link_to_file VARCHAR(4096);
|
||||
ALTER TABLE cc_files ADD COLUMN soundcloud_upload_time TIMESTAMP(6);
|
|
@ -1,3 +0,0 @@
|
|||
ALTER TABLE cc_show_instances DROP COLUMN IF EXISTS autoplaylist_built;
|
||||
ALTER TABLE cc_show DROP COLUMN IF EXISTS has_autoplaylist;
|
||||
ALTER TABLE cc_show DROP COLUMN IF EXISTS autoplaylist_id;
|
|
@ -54,16 +54,10 @@ class PageLayoutInitPlugin extends Zend_Controller_Plugin_Abstract
|
|||
$this->_initViewHelpers();
|
||||
}
|
||||
|
||||
// Skip upgrades and task management when running unit tests
|
||||
// Skip task management when running unit tests
|
||||
if (getenv('AIRTIME_UNIT_TEST') != 1) {
|
||||
$taskManager = TaskManager::getInstance();
|
||||
|
||||
// Run the upgrade on each request (if it needs to be run)
|
||||
// We can't afford to wait 7 minutes to run an upgrade: users could
|
||||
// have several minutes of database errors while waiting for a
|
||||
// schema change upgrade to happen after a deployment
|
||||
$taskManager->runTask('UpgradeTask');
|
||||
|
||||
// Piggyback the TaskManager onto API calls. This provides guaranteed consistency
|
||||
// (there is at least one API call made from pypo to Airtime every 7 minutes) and
|
||||
// greatly reduces the chances of lock contention on cc_pref while the TaskManager runs
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
ALTER TABLE cc_files ADD COLUMN filesize integer NOT NULL
|
||||
CONSTRAINT filesize_default DEFAULT 0
|
|
@ -1,2 +0,0 @@
|
|||
ALTER TABLE cc_show ALTER COLUMN description TYPE varchar(8192);
|
||||
ALTER TABLE cc_show_instances ALTER COLUMN description TYPE varchar(8192);
|
|
@ -1,42 +0,0 @@
|
|||
-----------------------------------------------------------------------
|
||||
-- third_party_track_references
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "third_party_track_references"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"service" VARCHAR(256) NOT NULL,
|
||||
"foreign_id" VARCHAR(256),
|
||||
"file_id" INTEGER NOT NULL,
|
||||
"upload_time" TIMESTAMP,
|
||||
"status" VARCHAR(256),
|
||||
PRIMARY KEY ("id"),
|
||||
CONSTRAINT "foreign_id_unique" UNIQUE ("foreign_id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- celery_tasks
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "celery_tasks"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"task_id" VARCHAR(256) NOT NULL,
|
||||
"track_reference" INTEGER NOT NULL,
|
||||
"name" VARCHAR(256),
|
||||
"dispatch_time" TIMESTAMP,
|
||||
"status" VARCHAR(256) NOT NULL,
|
||||
PRIMARY KEY ("id"),
|
||||
CONSTRAINT "id_unique" UNIQUE ("id")
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE "third_party_track_references" ADD CONSTRAINT "track_reference_fkey"
|
||||
FOREIGN KEY ("file_id")
|
||||
REFERENCES "cc_files" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "celery_tasks" ADD CONSTRAINT "celery_service_fkey"
|
||||
FOREIGN KEY ("track_reference")
|
||||
REFERENCES "third_party_track_references" ("id")
|
||||
ON DELETE CASCADE;
|
|
@ -1,3 +0,0 @@
|
|||
ALTER TABLE cc_pref ALTER COLUMN subjid SET DEFAULT NULL;
|
||||
CREATE UNIQUE INDEX cc_pref_key_idx ON cc_pref (keystr) WHERE subjid IS NULL;
|
||||
ANALYZE cc_pref;
|
|
@ -1 +0,0 @@
|
|||
ALTER TABLE third_party_track_references ALTER COLUMN file_id DROP NOT NULL;
|
|
@ -1,90 +0,0 @@
|
|||
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;
|
|
@ -1 +0,0 @@
|
|||
ALTER TABLE cc_files ADD COLUMN artwork TYPE character varying(255);
|
|
@ -1,6 +0,0 @@
|
|||
-- Replacing system_version with schema_version
|
||||
DELETE FROM cc_pref WHERE keystr = 'system_version';
|
||||
INSERT INTO cc_pref (keystr, valstr) VALUES ('schema_version', '2.5.2');
|
||||
|
||||
ALTER TABLE cc_show ADD COLUMN image_path varchar(255) DEFAULT '';
|
||||
ALTER TABLE cc_show_instances ADD COLUMN description varchar(255) DEFAULT '';
|
|
@ -1,6 +0,0 @@
|
|||
DELETE FROM cc_pref WHERE keystr = 'system_version';
|
||||
INSERT INTO cc_pref (keystr, valstr) VALUES ('system_version', '2.5.3');
|
||||
|
||||
ALTER TABLE cc_files DROP COLUMN state;
|
||||
ALTER TABLE cc_files ADD import_status integer default 1; -- Default is "pending"
|
||||
UPDATE cc_files SET import_status=0; -- Existing files are already "imported"
|
|
@ -1,5 +0,0 @@
|
|||
DELETE FROM cc_pref WHERE keystr = 'system_version';
|
||||
INSERT INTO cc_pref (keystr, valstr) VALUES ('system_version', '2.5.5');
|
||||
|
||||
ALTER TABLE cc_show ADD COLUMN image_path varchar(255) DEFAULT '';
|
||||
ALTER TABLE cc_show_instances ADD COLUMN description varchar(255) DEFAULT '';
|
|
@ -1,11 +0,0 @@
|
|||
CREATE TABLE cloud_file
|
||||
(
|
||||
id serial NOT NULL,
|
||||
resource_id text NOT NULL,
|
||||
storage_backend text NOT NULL,
|
||||
cc_file_id integer NOT NULL,
|
||||
CONSTRAINT cloud_file_pkey PRIMARY KEY (id),
|
||||
CONSTRAINT "cloud_file_FK_1" FOREIGN KEY (cc_file_id)
|
||||
REFERENCES cc_files (id) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION ON DELETE CASCADE
|
||||
)
|
|
@ -1,4 +0,0 @@
|
|||
ALTER TABLE imported_podcast ADD COLUMN album_override boolean default 'f' NOT NULL;
|
||||
ALTER TABLE third_party_track_references ALTER COLUMN file_id SET DEFAULT 0;
|
||||
ALTER TABLE third_party_track_references ALTER COLUMN file_id DROP NOT NULL;
|
||||
ALTER TABLE cc_show ADD COLUMN autoplaylist_repeat boolean default 'f' NOT NULL;
|
|
@ -1 +0,0 @@
|
|||
ALTER TABLE cc_service_register ALTER COLUMN ip TYPE character varying(45);
|
|
@ -1,2 +0,0 @@
|
|||
ALTER TABLE podcast_episodes ADD COLUMN episode_title VARCHAR(4096);
|
||||
ALTER TABLE podcast_episodes ADD COLUMN episode_description VARCHAR(4096);
|
|
@ -1 +0,0 @@
|
|||
ALTER TABLE cc_blockcriteria ADD COLUMN criteriagroup integer;
|
|
@ -1 +0,0 @@
|
|||
ALTER TABLE podcast_episodes ALTER COLUMN episode_description TYPE text;
|
|
@ -1 +0,0 @@
|
|||
ALTER TABLE cc_block ALTER COLUMN type SET DEFAULT 'dynamic';
|
|
@ -1 +0,0 @@
|
|||
ALTER TABLE cc_files ADD COLUMN artwork VARCHAR(4096);
|
|
@ -1,25 +0,0 @@
|
|||
ALTER TABLE cc_files ADD COLUMN track_type VARCHAR(16);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "cc_track_types"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"code" VARCHAR(16) NOT NULL,
|
||||
"type_name" VARCHAR(64),
|
||||
"description" VARCHAR(255),
|
||||
"visibility" boolean DEFAULT true NOT NULL,
|
||||
CONSTRAINT "cc_track_types_pkey" PRIMARY KEY ("id"),
|
||||
CONSTRAINT "cc_track_types_code_key" UNIQUE ("code")
|
||||
);
|
||||
|
||||
INSERT INTO cc_track_types VALUES (1, 'MUS', 'Music', 'This is used for tracks containing music.', true);
|
||||
INSERT INTO cc_track_types VALUES (2, 'SID', 'Station ID', 'This is used for Station IDs', true);
|
||||
INSERT INTO cc_track_types VALUES (3, 'INT', 'Show Intro', 'This can be used for organizing all the show introductions.', true);
|
||||
INSERT INTO cc_track_types VALUES (4, 'OUT', 'Show Outro', 'This can be used for organizing all the show outroductions.', true);
|
||||
INSERT INTO cc_track_types VALUES (5, 'SWP', 'Sweeper', 'This is used for segues between songs.', true);
|
||||
INSERT INTO cc_track_types VALUES (6, 'JIN', 'Jingle', 'A short song or tune, normally played during commercial breaks. Contains one or more hooks.', true);
|
||||
INSERT INTO cc_track_types VALUES (7, 'PRO', 'Promo', 'For promotional use.', true);
|
||||
INSERT INTO cc_track_types VALUES (8, 'SHO', 'Shout Out', 'A message of congratulation, greeting. support, or appreciation. ', true);
|
||||
INSERT INTO cc_track_types VALUES (9, 'NWS', 'News', 'This is used for noteworthy information, announcements.', true);
|
||||
INSERT INTO cc_track_types VALUES (10, 'COM', 'Commercial', 'This is used for commerical advertising.', true);
|
||||
INSERT INTO cc_track_types VALUES (11, 'ITV', 'Interview', 'This is used for radio interviews', true);
|
||||
INSERT INTO cc_track_types VALUES (12, 'VTR', 'Voice Tracking', 'Also referred as robojock or taped. Make announcements without actually being in the station.', true);
|
|
@ -1 +0,0 @@
|
|||
DROP TABLE IF EXISTS "cc_smemb" CASCADE;
|
|
@ -1,5 +0,0 @@
|
|||
ALTER TABLE cc_files DROP COLUMN soundcloud_id;
|
||||
ALTER TABLE cc_files DROP COLUMN soundcloud_error_code;
|
||||
ALTER TABLE cc_files DROP COLUMN soundcloud_error_msg;
|
||||
ALTER TABLE cc_files DROP COLUMN soundcloud_link_to_file;
|
||||
ALTER TABLE cc_files DROP COLUMN soundcloud_upload_time;
|
|
@ -1,3 +0,0 @@
|
|||
ALTER TABLE cc_show ADD COLUMN has_autoplaylist boolean default 'f' NOT NULL;
|
||||
ALTER TABLE cc_show ADD COLUMN autoplaylist_id integer DEFAULT NULL;
|
||||
ALTER TABLE cc_show_instances ADD COLUMN autoplaylist_built boolean default 'f' NOT NULL;
|
|
@ -1,726 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Check if a given classname belongs to a subclass of AirtimeUpgrader.
|
||||
*
|
||||
* @param $c string class name
|
||||
*
|
||||
* @return bool true if the $c is a subclass of AirtimeUpgrader
|
||||
*/
|
||||
function isUpgrade($c)
|
||||
{
|
||||
return is_subclass_of($c, 'AirtimeUpgrader');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter all declared classes to get all upgrade classes dynamically.
|
||||
*
|
||||
* @return array all upgrade classes
|
||||
*/
|
||||
function getUpgrades()
|
||||
{
|
||||
return array_filter(get_declared_classes(), 'isUpgrade');
|
||||
}
|
||||
|
||||
class UpgradeManager
|
||||
{
|
||||
/**
|
||||
* Used to determine if the database schema needs an upgrade in order for this version of the Airtime codebase to work correctly.
|
||||
*
|
||||
* @return array a list of schema versions that this version of the codebase supports
|
||||
*/
|
||||
public static function getSupportedSchemaVersions()
|
||||
{
|
||||
$config = Config::getConfig();
|
||||
// What versions of the schema does the code support today:
|
||||
return [$config['airtime_version']];
|
||||
}
|
||||
|
||||
public static function checkIfUpgradeIsNeeded()
|
||||
{
|
||||
$schemaVersion = Application_Model_Preference::GetSchemaVersion();
|
||||
$supportedSchemaVersions = self::getSupportedSchemaVersions();
|
||||
|
||||
return !in_array($schemaVersion, $supportedSchemaVersions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Upgrade the Airtime schema version to match the highest supported version.
|
||||
*
|
||||
* @return bool whether or not an upgrade was performed
|
||||
*/
|
||||
public static function doUpgrade()
|
||||
{
|
||||
// Get all upgrades dynamically (in declaration order!) so we don't have to add them explicitly each time
|
||||
// TODO: explicitly sort classnames by ascending version suffix for safety
|
||||
$upgraders = getUpgrades();
|
||||
$dir = (dirname(__DIR__) . '/controllers');
|
||||
$upgradePerformed = false;
|
||||
|
||||
foreach ($upgraders as $upgrader) {
|
||||
$upgradePerformed = self::_runUpgrade(new $upgrader($dir)) ? true : $upgradePerformed;
|
||||
}
|
||||
|
||||
return $upgradePerformed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Downgrade the Airtime schema version to match the given version.
|
||||
*
|
||||
* @param string $toVersion the version we want to downgrade to
|
||||
*
|
||||
* @return bool whether or not an upgrade was performed
|
||||
*/
|
||||
public static function doDowngrade($toVersion)
|
||||
{
|
||||
$downgraders = array_reverse(getUpgrades()); // Reverse the array because we're downgrading
|
||||
$dir = (dirname(__DIR__) . '/controllers');
|
||||
$downgradePerformed = false;
|
||||
|
||||
foreach ($downgraders as $downgrader) {
|
||||
/** @var AirtimeUpgrader $downgrader */
|
||||
$downgrader = new $downgrader($dir);
|
||||
if ($downgrader->getNewVersion() == $toVersion) {
|
||||
break; // We've reached the version we wanted to downgrade to, so break
|
||||
}
|
||||
$downgradePerformed = self::_runDowngrade($downgrader) ? true : $downgradePerformed;
|
||||
}
|
||||
|
||||
return $downgradePerformed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the given upgrade.
|
||||
*
|
||||
* @param $upgrader AirtimeUpgrader the upgrader class to be executed
|
||||
*
|
||||
* @return bool true if the upgrade was successful, otherwise false
|
||||
*/
|
||||
private static function _runUpgrade(AirtimeUpgrader $upgrader)
|
||||
{
|
||||
return $upgrader->checkIfUpgradeSupported() && $upgrader->upgrade();
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the given downgrade.
|
||||
*
|
||||
* @param $downgrader AirtimeUpgrader the upgrader class to be executed
|
||||
* @param $supportedVersions array array of supported versions
|
||||
*
|
||||
* @return bool true if the downgrade was successful, otherwise false
|
||||
*/
|
||||
private static function _runDowngrade(AirtimeUpgrader $downgrader)
|
||||
{
|
||||
return $downgrader->checkIfDowngradeSupported() && $downgrader->downgrade();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class AirtimeUpgrader
|
||||
{
|
||||
protected $_dir;
|
||||
|
||||
protected $host;
|
||||
protected $port;
|
||||
protected $database;
|
||||
protected $username;
|
||||
protected $password;
|
||||
|
||||
/**
|
||||
* @param $dir string directory housing upgrade files
|
||||
*/
|
||||
public function __construct($dir)
|
||||
{
|
||||
$this->_dir = $dir;
|
||||
}
|
||||
|
||||
/** Schema versions that this upgrader class can upgrade from (an array of version strings). */
|
||||
abstract protected function getSupportedSchemaVersions();
|
||||
|
||||
/** The schema version that this upgrader class will upgrade to. (returns a version string) */
|
||||
abstract public function getNewVersion();
|
||||
|
||||
public static function getCurrentSchemaVersion()
|
||||
{
|
||||
return Application_Model_Preference::GetSchemaVersion();
|
||||
}
|
||||
|
||||
/**
|
||||
* This function checks to see if this class can perform an upgrade of your version of Airtime.
|
||||
*
|
||||
* @return bool true if we can upgrade your version of Airtime
|
||||
*/
|
||||
public function checkIfUpgradeSupported()
|
||||
{
|
||||
return in_array(static::getCurrentSchemaVersion(), $this->getSupportedSchemaVersions());
|
||||
}
|
||||
|
||||
/**
|
||||
* This function checks to see if this class can perform a downgrade of your version of Airtime.
|
||||
*
|
||||
* @return bool true if we can downgrade your version of Airtime
|
||||
*/
|
||||
public function checkIfDowngradeSupported()
|
||||
{
|
||||
return static::getCurrentSchemaVersion() == $this->getNewVersion();
|
||||
}
|
||||
|
||||
protected function toggleMaintenanceScreen($toggle)
|
||||
{
|
||||
if ($toggle) {
|
||||
// Disable Airtime UI
|
||||
// create a temporary maintenance notification file
|
||||
// when this file is on the server, zend framework redirects all
|
||||
// requests to the maintenance page and sets a 503 response code
|
||||
/* DISABLED because this does not work correctly
|
||||
$this->maintenanceFile = isset($_SERVER['AIRTIME_BASE']) ? $_SERVER['AIRTIME_BASE']."maintenance.txt" : "/tmp/maintenance.txt";
|
||||
$file = fopen($this->maintenanceFile, 'w');
|
||||
fclose($file);
|
||||
*/
|
||||
}
|
||||
// delete maintenance.txt to give users access back to Airtime
|
||||
/* DISABLED because this does not work correctly
|
||||
if ($this->maintenanceFile) {
|
||||
unlink($this->maintenanceFile);
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement this for each new version of Airtime
|
||||
* This function abstracts out the core upgrade functionality,
|
||||
* allowing child classes to overwrite _runUpgrade to reduce duplication.
|
||||
*/
|
||||
public function upgrade()
|
||||
{
|
||||
try {
|
||||
// $this->toggleMaintenanceScreen(true);
|
||||
|
||||
$this->_getDbValues();
|
||||
$this->_runUpgrade();
|
||||
|
||||
Application_Model_Preference::SetSchemaVersion($this->getNewVersion());
|
||||
|
||||
// $this->toggleMaintenanceScreen(false);
|
||||
} catch (Exception $e) {
|
||||
// $this->toggleMaintenanceScreen(false);
|
||||
Logging::error('Error in upgrade: ' . $e->getMessage());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement this for each new version of Airtime
|
||||
* This function abstracts out the core downgrade functionality,
|
||||
* allowing child classes to overwrite _runDowngrade to reduce duplication.
|
||||
*/
|
||||
public function downgrade()
|
||||
{
|
||||
try {
|
||||
$this->_getDbValues();
|
||||
$this->_runDowngrade();
|
||||
|
||||
$highestSupportedVersion = null;
|
||||
foreach ($this->getSupportedSchemaVersions() as $v) {
|
||||
// version_compare returns 1 (true) if the second parameter is lower
|
||||
if (!$highestSupportedVersion || version_compare($v, $highestSupportedVersion)) {
|
||||
$highestSupportedVersion = $v;
|
||||
}
|
||||
}
|
||||
|
||||
// Set the schema version to the highest supported version so we don't skip versions when downgrading
|
||||
Application_Model_Preference::SetSchemaVersion($highestSupportedVersion);
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function _getDbValues()
|
||||
{
|
||||
$config = Config::getConfig();
|
||||
|
||||
$this->host = $config['dsn']['host'];
|
||||
$this->port = $config['dsn']['port'];
|
||||
$this->username = $config['dsn']['username'];
|
||||
$this->password = $config['dsn']['password'];
|
||||
$this->database = $config['dsn']['database'];
|
||||
}
|
||||
|
||||
protected function _runPsql($args)
|
||||
{
|
||||
$command = <<<"END"
|
||||
PGPASSWORD={$this->password} \\
|
||||
/usr/bin/psql --quiet \\
|
||||
--host={$this->host} \\
|
||||
--port={$this->port} \\
|
||||
--dbname={$this->database} \\
|
||||
--username={$this->username} \\
|
||||
{$args}
|
||||
END;
|
||||
passthru($command);
|
||||
}
|
||||
|
||||
protected function _runUpgrade()
|
||||
{
|
||||
$sqlFile = "{$this->_dir}/upgrade_sql/airtime_{$this->getNewVersion()}/upgrade.sql";
|
||||
$args = <<<"END"
|
||||
--file={$sqlFile} 2>&1 \\
|
||||
| grep -v -E "will create implicit sequence|will create implicit index"
|
||||
END;
|
||||
$this->_runPsql($args);
|
||||
}
|
||||
|
||||
protected function _runDowngrade()
|
||||
{
|
||||
$sqlFile = "{$this->_dir}/downgrade_sql/airtime_{$this->getNewVersion()}/downgrade.sql";
|
||||
$args = <<<"END"
|
||||
--file={$sqlFile} 2>&1 \\
|
||||
| grep -v -E "will create implicit sequence|will create implicit index"
|
||||
END;
|
||||
$this->_runPsql($args);
|
||||
}
|
||||
}
|
||||
|
||||
class AirtimeUpgrader253 extends AirtimeUpgrader
|
||||
{
|
||||
protected function getSupportedSchemaVersions()
|
||||
{
|
||||
return ['2.5.1', '2.5.2'];
|
||||
}
|
||||
|
||||
public function getNewVersion()
|
||||
{
|
||||
return '2.5.3';
|
||||
}
|
||||
|
||||
protected function _runUpgrade()
|
||||
{
|
||||
// Update disk_usage value in cc_pref
|
||||
$storDir = isset($_SERVER['AIRTIME_BASE']) ? $_SERVER['AIRTIME_BASE'] . 'srv/airtime/stor' : '/srv/airtime/stor';
|
||||
$diskUsage = shell_exec("du -sb {$storDir} | awk '{print $1}'");
|
||||
|
||||
Application_Model_Preference::setDiskUsage($diskUsage);
|
||||
|
||||
parent::_runUpgrade();
|
||||
}
|
||||
}
|
||||
|
||||
class AirtimeUpgrader254 extends AirtimeUpgrader
|
||||
{
|
||||
protected function getSupportedSchemaVersions()
|
||||
{
|
||||
return ['2.5.3'];
|
||||
}
|
||||
|
||||
public function getNewVersion()
|
||||
{
|
||||
return '2.5.4';
|
||||
}
|
||||
|
||||
protected function _runUpgrade()
|
||||
{
|
||||
// First, ensure there are no superadmins already.
|
||||
$numberOfSuperAdmins = CcSubjsQuery::create()
|
||||
->filterByDbType(UTYPE_SUPERADMIN)
|
||||
->filterByDbLogin('sourcefabric_admin', Criteria::NOT_EQUAL) // Ignore sourcefabric_admin users
|
||||
->count();
|
||||
|
||||
// Only create a super admin if there isn't one already.
|
||||
if ($numberOfSuperAdmins == 0) {
|
||||
// Find the "admin" user and promote them to superadmin.
|
||||
$adminUser = CcSubjsQuery::create()
|
||||
->filterByDbLogin('admin')
|
||||
->findOne();
|
||||
if (!$adminUser) {
|
||||
// Otherwise get the user with the lowest ID that is of type administrator:
|
||||
$adminUser = CcSubjsQuery::create()
|
||||
->filterByDbType(UTYPE_ADMIN)
|
||||
->orderByDbId(Criteria::ASC)
|
||||
->findOne();
|
||||
|
||||
if (!$adminUser) {
|
||||
throw new Exception("Failed to find any users of type 'admin' ('A').");
|
||||
}
|
||||
}
|
||||
|
||||
$adminUser = new Application_Model_User($adminUser->getDbId());
|
||||
$adminUser->setType(UTYPE_SUPERADMIN);
|
||||
$adminUser->save();
|
||||
Logging::info($_SERVER['HTTP_HOST'] . ': ' . $this->getNewVersion() . ' Upgrade: Promoted user ' . $adminUser->getLogin() . ' to be a Super Admin.');
|
||||
|
||||
// Also try to promote the sourcefabric_admin user
|
||||
$sofabAdminUser = CcSubjsQuery::create()
|
||||
->filterByDbLogin('sourcefabric_admin')
|
||||
->findOne();
|
||||
if ($sofabAdminUser) {
|
||||
$sofabAdminUser = new Application_Model_User($sofabAdminUser->getDbId());
|
||||
$sofabAdminUser->setType(UTYPE_SUPERADMIN);
|
||||
$sofabAdminUser->save();
|
||||
Logging::info($_SERVER['HTTP_HOST'] . ': ' . $this->getNewVersion() . ' Upgrade: Promoted user ' . $sofabAdminUser->getLogin() . ' to be a Super Admin.');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class AirtimeUpgrader255 extends AirtimeUpgrader
|
||||
{
|
||||
protected function getSupportedSchemaVersions()
|
||||
{
|
||||
return [
|
||||
'2.5.4',
|
||||
];
|
||||
}
|
||||
|
||||
public function getNewVersion()
|
||||
{
|
||||
return '2.5.5';
|
||||
}
|
||||
}
|
||||
|
||||
class AirtimeUpgrader259 extends AirtimeUpgrader
|
||||
{
|
||||
protected function getSupportedSchemaVersions()
|
||||
{
|
||||
return [
|
||||
'2.5.5',
|
||||
];
|
||||
}
|
||||
|
||||
public function getNewVersion()
|
||||
{
|
||||
return '2.5.9';
|
||||
}
|
||||
}
|
||||
|
||||
class AirtimeUpgrader2510 extends AirtimeUpgrader
|
||||
{
|
||||
protected function getSupportedSchemaVersions()
|
||||
{
|
||||
return [
|
||||
'2.5.9',
|
||||
];
|
||||
}
|
||||
|
||||
public function getNewVersion()
|
||||
{
|
||||
return '2.5.10';
|
||||
}
|
||||
}
|
||||
|
||||
class AirtimeUpgrader2511 extends AirtimeUpgrader
|
||||
{
|
||||
protected function getSupportedSchemaVersions()
|
||||
{
|
||||
return [
|
||||
'2.5.10',
|
||||
];
|
||||
}
|
||||
|
||||
public function getNewVersion()
|
||||
{
|
||||
return '2.5.11';
|
||||
}
|
||||
|
||||
protected function _runUpgrade()
|
||||
{
|
||||
$queryResult = CcFilesQuery::create()
|
||||
->select(['disk_usage'])
|
||||
->withColumn('SUM(CcFiles.filesize)', 'disk_usage')
|
||||
->find();
|
||||
$disk_usage = $queryResult[0];
|
||||
Application_Model_Preference::setDiskUsage($disk_usage);
|
||||
}
|
||||
}
|
||||
|
||||
class AirtimeUpgrader2512 extends AirtimeUpgrader
|
||||
{
|
||||
protected function getSupportedSchemaVersions()
|
||||
{
|
||||
return [
|
||||
'2.5.10',
|
||||
'2.5.11',
|
||||
];
|
||||
}
|
||||
|
||||
public function getNewVersion()
|
||||
{
|
||||
return '2.5.12';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class AirtimeUpgrader2513 - Celery and SoundCloud upgrade.
|
||||
*
|
||||
* Adds third_party_track_references and celery_tasks tables for third party service
|
||||
* authentication and task architecture.
|
||||
*
|
||||
* <br/><b>third_party_track_references</b> schema:
|
||||
*
|
||||
* id -> int PK
|
||||
* service -> string internal service name
|
||||
* foreign_id -> int external unique service id
|
||||
* file_id -> int internal FK->cc_files track id
|
||||
* upload_time -> timestamp internal upload timestamp
|
||||
* status -> string external service status
|
||||
*
|
||||
* <br/><b>celery_tasks</b> schema:
|
||||
*
|
||||
* id -> int PK
|
||||
* task_id -> string external unique amqp results identifier
|
||||
* track_reference -> int internal FK->third_party_track_references id
|
||||
* name -> string external Celery task name
|
||||
* dispatch_time -> timestamp internal message dispatch time
|
||||
* status -> string external Celery task status
|
||||
*/
|
||||
class AirtimeUpgrader2513 extends AirtimeUpgrader
|
||||
{
|
||||
protected function getSupportedSchemaVersions()
|
||||
{
|
||||
return [
|
||||
'2.5.12',
|
||||
];
|
||||
}
|
||||
|
||||
public function getNewVersion()
|
||||
{
|
||||
return '2.5.13';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class AirtimeUpgrader2514.
|
||||
*
|
||||
* SAAS-923 - Add a partial constraint to cc_pref so that keystrings must be unique
|
||||
*/
|
||||
class AirtimeUpgrader2514 extends AirtimeUpgrader
|
||||
{
|
||||
protected function getSupportedSchemaVersions()
|
||||
{
|
||||
return [
|
||||
'2.5.13',
|
||||
];
|
||||
}
|
||||
|
||||
public function getNewVersion()
|
||||
{
|
||||
return '2.5.14';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class AirtimeUpgrader2515.
|
||||
*
|
||||
* SAAS-1071 - Remove not null constraint from file_id fk in third_party_track_references
|
||||
* so that we can create track references for downloads (which won't have a file
|
||||
* ID until the task is run and the file is POSTed back to Airtime)
|
||||
*/
|
||||
class AirtimeUpgrader2515 extends AirtimeUpgrader
|
||||
{
|
||||
protected function getSupportedSchemaVersions()
|
||||
{
|
||||
return [
|
||||
'2.5.14',
|
||||
];
|
||||
}
|
||||
|
||||
public function getNewVersion()
|
||||
{
|
||||
return '2.5.15';
|
||||
}
|
||||
}
|
||||
|
||||
class AirtimeUpgrader2516 extends AirtimeUpgrader
|
||||
{
|
||||
protected function getSupportedSchemaVersions()
|
||||
{
|
||||
return [
|
||||
'2.5.15',
|
||||
];
|
||||
}
|
||||
|
||||
public function getNewVersion()
|
||||
{
|
||||
return '2.5.16';
|
||||
}
|
||||
}
|
||||
class AirtimeUpgrader300alpha extends AirtimeUpgrader
|
||||
{
|
||||
protected function getSupportedSchemaVersions()
|
||||
{
|
||||
return [
|
||||
'2.5.16',
|
||||
];
|
||||
}
|
||||
|
||||
public function getNewVersion()
|
||||
{
|
||||
return '3.0.0-alpha';
|
||||
}
|
||||
}
|
||||
|
||||
class AirtimeUpgrader300alpha1 extends AirtimeUpgrader
|
||||
{
|
||||
protected function getSupportedSchemaVersions()
|
||||
{
|
||||
return [
|
||||
'3.0.0-alpha',
|
||||
];
|
||||
}
|
||||
|
||||
public function getNewVersion()
|
||||
{
|
||||
return '3.0.0-alpha.1';
|
||||
}
|
||||
}
|
||||
|
||||
class AirtimeUpgrader300alpha6 extends AirtimeUpgrader
|
||||
{
|
||||
protected function getSupportedSchemaVersions()
|
||||
{
|
||||
return [
|
||||
'3.0.0-alpha.1',
|
||||
];
|
||||
}
|
||||
|
||||
public function getNewVersion()
|
||||
{
|
||||
return '3.0.0-alpha.6';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class AirtimeUpgrader300alpha7.
|
||||
*
|
||||
* GH-#636 - https://github.com/libretime/libretime/pull/636 - Change dynamic smartblock to be default smartblock type
|
||||
*/
|
||||
class AirtimeUpgrader300alpha7 extends AirtimeUpgrader
|
||||
{
|
||||
protected function getSupportedSchemaVersions()
|
||||
{
|
||||
return [
|
||||
'3.0.0-alpha.6',
|
||||
];
|
||||
}
|
||||
|
||||
public function getNewVersion()
|
||||
{
|
||||
return '3.0.0-alpha.7';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class AirtimeUpgrader300alpha7-1.
|
||||
*
|
||||
* GH-#659 - https://github.com/libretime/libretime/pull/659/ - Add description and title to podcast episodes database table
|
||||
*/
|
||||
class AirtimeUpgrader300alpha7_1 extends AirtimeUpgrader
|
||||
{
|
||||
protected function getSupportedSchemaVersions()
|
||||
{
|
||||
return [
|
||||
'3.0.0-alpha.7',
|
||||
];
|
||||
}
|
||||
|
||||
public function getNewVersion()
|
||||
{
|
||||
return '3.0.0-alpha.7.1';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class AirtimeUpgrader300alpha7-2.
|
||||
*
|
||||
* GH-#704 - https://github.com/libretime/libretime/pull/704/ - Add criteria group to smartblock table to enable database to store separately
|
||||
*/
|
||||
class AirtimeUpgrader300alpha7_2 extends AirtimeUpgrader
|
||||
{
|
||||
protected function getSupportedSchemaVersions()
|
||||
{
|
||||
return [
|
||||
'3.0.0-alpha.7.1',
|
||||
];
|
||||
}
|
||||
|
||||
public function getNewVersion()
|
||||
{
|
||||
return '3.0.0-alpha.7.2';
|
||||
}
|
||||
}
|
||||
class AirtimeUpgrader300alpha7_3 extends AirtimeUpgrader
|
||||
{
|
||||
protected function getSupportedSchemaVersions()
|
||||
{
|
||||
return [
|
||||
'3.0.0-alpha.7.2',
|
||||
];
|
||||
}
|
||||
|
||||
public function getNewVersion()
|
||||
{
|
||||
return '3.0.0-alpha.7.3';
|
||||
}
|
||||
}
|
||||
|
||||
class AirtimeUpgrader300alpha9_1 extends AirtimeUpgrader
|
||||
{
|
||||
protected function getSupportedSchemaVersions()
|
||||
{
|
||||
return [
|
||||
'3.0.0-alpha.7.3',
|
||||
];
|
||||
}
|
||||
|
||||
public function getNewVersion()
|
||||
{
|
||||
return '3.0.0-alpha.9.1';
|
||||
}
|
||||
}
|
||||
|
||||
class AirtimeUpgrader300alpha9_2 extends AirtimeUpgrader
|
||||
{
|
||||
protected function getSupportedSchemaVersions()
|
||||
{
|
||||
return [
|
||||
'3.0.0-alpha.9.1',
|
||||
];
|
||||
}
|
||||
|
||||
public function getNewVersion()
|
||||
{
|
||||
return '3.0.0-alpha.9.2';
|
||||
}
|
||||
}
|
||||
|
||||
class AirtimeUpgrader200alpha9_3 extends AirtimeUpgrader
|
||||
{
|
||||
protected function getSupportedSchemaVersions()
|
||||
{
|
||||
return [
|
||||
'3.0.0-alpha.9.2',
|
||||
];
|
||||
}
|
||||
|
||||
public function getNewVersion()
|
||||
{
|
||||
return '3.0.0-alpha.9.3';
|
||||
}
|
||||
}
|
||||
|
||||
class AirtimeUpgrader200alpha9_4 extends AirtimeUpgrader
|
||||
{
|
||||
protected function getSupportedSchemaVersions()
|
||||
{
|
||||
return [
|
||||
'3.0.0-alpha.9.3',
|
||||
];
|
||||
}
|
||||
|
||||
public function getNewVersion()
|
||||
{
|
||||
return '3.0.0-alpha.9.4';
|
||||
}
|
||||
}
|
|
@ -18,7 +18,8 @@ propel.conf.dir = ${project.build}
|
|||
propel.output.dir = ${project.home}
|
||||
propel.php.dir = ${propel.output.dir}/application/models
|
||||
propel.phpconf.dir = ${propel.output.dir}/application/configs
|
||||
propel.sql.dir = ${project.build}/sql
|
||||
# propel.sql.dir = ${project.build}/sql
|
||||
propel.sql.dir = ${project.home}/../api/libretime_api/legacy/migrations/sql
|
||||
|
||||
# set the name for the configuration file
|
||||
# set the name for the configuration file
|
||||
|
|
|
@ -1,375 +0,0 @@
|
|||
-- Schema version
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('schema_version', '3.0.0-alpha');
|
||||
|
||||
INSERT INTO cc_subjs ("login", "type", "pass") VALUES ('admin', 'A', md5('admin'));
|
||||
-- added in 2.3
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('off_air_meta', 'LibreTime - offline', 'string');
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('enable_replay_gain', 1);
|
||||
-- end of added in 2.3
|
||||
|
||||
-- added in 2.1
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('scheduled_play_switch', 'on');
|
||||
|
||||
INSERT INTO cc_live_log("state", "start_time") VALUES('S', now() at time zone 'UTC');
|
||||
-- end of added in 2.1
|
||||
|
||||
-- added in 2.0.0
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('stream_type', 'ogg, mp3, opus, aac');
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('stream_bitrate', '24, 32, 48, 64, 96, 128, 160, 192, 224, 256, 320');
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('num_of_streams', '3');
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('max_bitrate', '320');
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('plan_level', 'disabled');
|
||||
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('output_sound_device', 'false', 'boolean');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('output_sound_device_type', 'ALSA', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('icecast_vorbis_metadata', 'false', 'boolean');
|
||||
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_enable', 'true', 'boolean');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_output', 'icecast', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_type', 'ogg', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_bitrate', '128', 'integer');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_host', '127.0.0.1', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_port', '8000', 'integer');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_user', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_pass', 'hackme', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_admin_user', 'admin', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_admin_pass', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_mount', 'airtime_128', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_url', 'https://libretime.org', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_description', 'LibreTime Radio! Stream #1', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_genre', 'genre', 'string');
|
||||
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_enable', 'false', 'boolean');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_output', 'icecast', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_type', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_bitrate', '', 'integer');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_host', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_port', '', 'integer');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_user', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_pass', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_admin_user', 'admin', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_admin_pass', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_mount', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_url', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_description', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_genre', '', 'string');
|
||||
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_enable', 'false', 'boolean');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_output', 'icecast', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_type', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_bitrate', '', 'integer');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_host', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_port', '', 'integer');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_user', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_pass', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_admin_user', 'admin', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_admin_pass', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_mount', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_url', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_description', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_genre', '', 'string');
|
||||
-- end of added in 2.0.0
|
||||
|
||||
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('AFG', 'Afghanistan ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ALA', 'Åland Islands');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ALB', 'Albania ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('DZA', 'Algeria ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ASM', 'American Samoa ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('AND', 'Andorra ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('AGO', 'Angola ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('AIA', 'Anguilla ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ATG', 'Antigua and Barbuda ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ARG', 'Argentina ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ARM', 'Armenia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ABW', 'Aruba ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('AUS', 'Australia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('AUT', 'Austria ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('AZE', 'Azerbaijan ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BHS', 'Bahamas ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BHR', 'Bahrain ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BGD', 'Bangladesh ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BRB', 'Barbados ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BLR', 'Belarus ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BEL', 'Belgium ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BLZ', 'Belize ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BEN', 'Benin ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BMU', 'Bermuda ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BTN', 'Bhutan ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BOL', 'Bolivia (Plurinational State of) ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BES', 'Bonaire, Saint Eustatius and Saba');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BIH', 'Bosnia and Herzegovina ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BWA', 'Botswana ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BRA', 'Brazil ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('VGB', 'British Virgin Islands ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BRN', 'Brunei Darussalam ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BGR', 'Bulgaria ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BFA', 'Burkina Faso ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BDI', 'Burundi ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('KHM', 'Cambodia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('CMR', 'Cameroon ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('CAN', 'Canada ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('CPV', 'Cape Verde ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('CYM', 'Cayman Islands ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('CAF', 'Central African Republic ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('TCD', 'Chad ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('CHL', 'Chile ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('CHN', 'China ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('HKG', 'China, Hong Kong Special Administrative Region');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MAC', 'China, Macao Special Administrative Region');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('COL', 'Colombia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('COM', 'Comoros ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('COG', 'Congo ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('COK', 'Cook Islands ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('CRI', 'Costa Rica ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('CIV', 'Côte d''Ivoire ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('HRV', 'Croatia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('CUB', 'Cuba ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('CUW', 'Curaçao');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('CYP', 'Cyprus ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('CZE', 'Czech Republic ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('PRK', 'Democratic People''s Republic of Korea ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('COD', 'Democratic Republic of the Congo ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('DNK', 'Denmark ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('DJI', 'Djibouti ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('DMA', 'Dominica ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('DOM', 'Dominican Republic ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ECU', 'Ecuador ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('EGY', 'Egypt ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SLV', 'El Salvador ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GNQ', 'Equatorial Guinea ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ERI', 'Eritrea ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('EST', 'Estonia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ETH', 'Ethiopia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('FRO', 'Faeroe Islands ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('FLK', 'Falkland Islands (Malvinas) ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('FJI', 'Fiji ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('FIN', 'Finland ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('FRA', 'France ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GUF', 'French Guiana ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('PYF', 'French Polynesia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GAB', 'Gabon ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GMB', 'Gambia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GEO', 'Georgia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('DEU', 'Germany ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GHA', 'Ghana ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GIB', 'Gibraltar ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GRC', 'Greece ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GRL', 'Greenland ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GRD', 'Grenada ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GLP', 'Guadeloupe ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GUM', 'Guam ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GTM', 'Guatemala ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GGY', 'Guernsey');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GIN', 'Guinea ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GNB', 'Guinea-Bissau ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GUY', 'Guyana ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('HTI', 'Haiti ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('VAT', 'Holy See ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('HND', 'Honduras ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('HUN', 'Hungary ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ISL', 'Iceland ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('IND', 'India ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('IDN', 'Indonesia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('IRN', 'Iran (Islamic Republic of)');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('IRQ', 'Iraq ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('IRL', 'Ireland ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('IMN', 'Isle of Man ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ISR', 'Israel ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ITA', 'Italy ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('JAM', 'Jamaica ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('JPN', 'Japan ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('JEY', 'Jersey');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('JOR', 'Jordan ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('KAZ', 'Kazakhstan ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('KEN', 'Kenya ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('KIR', 'Kiribati ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('KWT', 'Kuwait ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('KGZ', 'Kyrgyzstan ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('LAO', 'Lao People''s Democratic Republic ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('LVA', 'Latvia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('LBN', 'Lebanon ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('LSO', 'Lesotho ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('LBR', 'Liberia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('LBY', 'Libyan Arab Jamahiriya ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('LIE', 'Liechtenstein ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('LTU', 'Lithuania ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('LUX', 'Luxembourg ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MDG', 'Madagascar ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MWI', 'Malawi ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MYS', 'Malaysia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MDV', 'Maldives ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MLI', 'Mali ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MLT', 'Malta ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MHL', 'Marshall Islands ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MTQ', 'Martinique ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MRT', 'Mauritania ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MUS', 'Mauritius ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MYT', 'Mayotte');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MEX', 'Mexico ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('FSM', 'Micronesia (Federated States of)');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MCO', 'Monaco ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MNG', 'Mongolia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MNE', 'Montenegro');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MSR', 'Montserrat ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MAR', 'Morocco ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MOZ', 'Mozambique ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MMR', 'Myanmar ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('NAM', 'Namibia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('NRU', 'Nauru ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('NPL', 'Nepal ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('NLD', 'Netherlands ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('NCL', 'New Caledonia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('NZL', 'New Zealand ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('NIC', 'Nicaragua ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('NER', 'Niger ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('NGA', 'Nigeria ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('NIU', 'Niue ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('NFK', 'Norfolk Island ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MNP', 'Northern Mariana Islands ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('NOR', 'Norway ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('PSE', 'Occupied Palestinian Territory ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('OMN', 'Oman ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('PAK', 'Pakistan ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('PLW', 'Palau ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('PAN', 'Panama ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('PNG', 'Papua New Guinea ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('PRY', 'Paraguay ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('PER', 'Peru ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('PHL', 'Philippines ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('PCN', 'Pitcairn ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('POL', 'Poland ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('PRT', 'Portugal ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('PRI', 'Puerto Rico ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('QAT', 'Qatar ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('KOR', 'Republic of Korea ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MDA', 'Republic of Moldova');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('REU', 'Réunion ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ROU', 'Romania ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('RUS', 'Russian Federation ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('RWA', 'Rwanda ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BLM', 'Saint-Barthélemy');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SHN', 'Saint Helena ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('KNA', 'Saint Kitts and Nevis ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('LCA', 'Saint Lucia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MAF', 'Saint-Martin (French part)');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SPM', 'Saint Pierre and Miquelon ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('VCT', 'Saint Vincent and the Grenadines ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('WSM', 'Samoa ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SMR', 'San Marino ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('STP', 'Sao Tome and Principe ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SAU', 'Saudi Arabia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SEN', 'Senegal ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SRB', 'Serbia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SYC', 'Seychelles ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SLE', 'Sierra Leone ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SGP', 'Singapore ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SXM', 'Sint Maarten (Dutch part)');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SVK', 'Slovakia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SVN', 'Slovenia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SLB', 'Solomon Islands ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SOM', 'Somalia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ZAF', 'South Africa ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ESP', 'Spain ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('LKA', 'Sri Lanka ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SDN', 'Sudan ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SUR', 'Suriname ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SJM', 'Svalbard and Jan Mayen Islands ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SWZ', 'Swaziland ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SWE', 'Sweden ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('CHE', 'Switzerland ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SYR', 'Syrian Arab Republic ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('TJK', 'Tajikistan ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('THA', 'Thailand ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MKD', 'The former Yugoslav Republic of Macedonia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('TLS', 'Timor-Leste');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('TGO', 'Togo ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('TKL', 'Tokelau ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('TON', 'Tonga ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('TTO', 'Trinidad and Tobago ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('TUN', 'Tunisia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('TUR', 'Turkey ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('TKM', 'Turkmenistan ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('TCA', 'Turks and Caicos Islands ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('TUV', 'Tuvalu ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('UGA', 'Uganda ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('UKR', 'Ukraine ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ARE', 'United Arab Emirates ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GBR', 'United Kingdom of Great Britain and Northern Ireland');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('TZA', 'United Republic of Tanzania ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('USA', 'United States of America');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('VIR', 'United States Virgin Islands ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('URY', 'Uruguay ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('UZB', 'Uzbekistan ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('VUT', 'Vanuatu ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('VEN', 'Venezuela (Bolivarian Republic of)');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('VNM', 'Viet Nam ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('WLF', 'Wallis and Futuna Islands ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ESH', 'Western Sahara ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('YEM', 'Yemen ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ZMB', 'Zambia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ZWE', 'Zimbabwe ');
|
||||
|
||||
|
||||
-- added in 2.2
|
||||
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_name', 'LibreTime!', 'string');
|
||||
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_name', '', 'string');
|
||||
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_name', '', 'string');
|
||||
|
||||
|
||||
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_channels', 'stereo', 'string');
|
||||
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_channels', 'stereo', 'string');
|
||||
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_channels', 'stereo', 'string');
|
||||
-- end of added in 2.2
|
||||
|
||||
|
||||
-- added in 2.3
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('locale', 'en_CA');
|
||||
|
||||
INSERT INTO cc_pref("subjid", "keystr", "valstr") VALUES(1, 'user_locale', 'en_CA');
|
||||
|
||||
-- end of added in 2.3
|
||||
|
||||
-- added in 2.5.2
|
||||
|
||||
INSERT INTO cc_pref (keystr, valstr) VALUES ('timezone', 'UTC');
|
||||
-- We don't want to set the user timezone by default - it should instead use the station timezone
|
||||
-- until the user changes it manually.
|
||||
-- INSERT INTO cc_pref (subjid, keystr, valstr) VALUES (1, 'user_timezone', 'UTC');
|
||||
|
||||
INSERT INTO cc_pref (keystr, valstr) VALUES ('import_timestamp', '0');
|
||||
|
||||
--end added in 2.5.2
|
||||
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s4_enable', 'false', 'boolean');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s4_output', 'icecast', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s4_name', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s4_type', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s4_bitrate', '', 'integer');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s4_host', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s4_port', '', 'integer');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s4_user', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s4_pass', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s4_admin_user', 'admin', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s4_admin_pass', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s4_mount', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s4_url', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s4_description', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s4_genre', '', 'string');
|
||||
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s4_channels', 'stereo', 'string');
|
||||
|
||||
-- added in 2.5.14 - this can't be set up in Propel's XML schema, so we need to do it here -- Duncan
|
||||
|
||||
ALTER TABLE cc_pref ALTER COLUMN subjid SET DEFAULT NULL;
|
||||
CREATE UNIQUE INDEX cc_pref_key_idx ON cc_pref (keystr) WHERE subjid IS NULL;
|
||||
ANALYZE cc_pref; -- this validates the new partial index
|
||||
|
||||
--end added in 2.5.14
|
||||
|
||||
-- For now, just needs to be truthy - to be updated later; we should find a better way to implement this...
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('whats_new_dialog_viewed', 1);
|
||||
|
||||
--added for LibreTime to turn on podcast album override by default 3.0.0.alpha6
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('podcast_album_override', 1);
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('podcast_auto_smartblock', 0);
|
||||
-- end
|
|
@ -1,987 +0,0 @@
|
|||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_music_dirs
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_music_dirs" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_music_dirs"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"directory" TEXT,
|
||||
"type" VARCHAR(255),
|
||||
"exists" BOOLEAN DEFAULT 't',
|
||||
"watched" BOOLEAN DEFAULT 't',
|
||||
PRIMARY KEY ("id"),
|
||||
CONSTRAINT "cc_music_dir_unique" UNIQUE ("directory")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_files
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_files" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_files"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"name" VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
"mime" VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
"ftype" VARCHAR(128) DEFAULT '' NOT NULL,
|
||||
"directory" INTEGER,
|
||||
"filepath" TEXT DEFAULT '',
|
||||
"import_status" INTEGER DEFAULT 1 NOT NULL,
|
||||
"currentlyaccessing" INTEGER DEFAULT 0 NOT NULL,
|
||||
"editedby" INTEGER,
|
||||
"mtime" TIMESTAMP(6),
|
||||
"utime" TIMESTAMP(6),
|
||||
"lptime" TIMESTAMP(6),
|
||||
"md5" CHAR(32),
|
||||
"track_title" VARCHAR(512),
|
||||
"artist_name" VARCHAR(512),
|
||||
"bit_rate" INTEGER,
|
||||
"sample_rate" INTEGER,
|
||||
"format" VARCHAR(128),
|
||||
"length" interval DEFAULT '00:00:00',
|
||||
"album_title" VARCHAR(512),
|
||||
"genre" VARCHAR(64),
|
||||
"comments" TEXT,
|
||||
"year" VARCHAR(16),
|
||||
"track_number" INTEGER,
|
||||
"channels" INTEGER,
|
||||
"url" VARCHAR(1024),
|
||||
"bpm" INTEGER,
|
||||
"rating" VARCHAR(8),
|
||||
"encoded_by" VARCHAR(255),
|
||||
"disc_number" VARCHAR(8),
|
||||
"mood" VARCHAR(64),
|
||||
"label" VARCHAR(512),
|
||||
"composer" VARCHAR(512),
|
||||
"encoder" VARCHAR(64),
|
||||
"checksum" VARCHAR(256),
|
||||
"lyrics" TEXT,
|
||||
"orchestra" VARCHAR(512),
|
||||
"conductor" VARCHAR(512),
|
||||
"lyricist" VARCHAR(512),
|
||||
"original_lyricist" VARCHAR(512),
|
||||
"radio_station_name" VARCHAR(512),
|
||||
"info_url" VARCHAR(512),
|
||||
"artist_url" VARCHAR(512),
|
||||
"audio_source_url" VARCHAR(512),
|
||||
"radio_station_url" VARCHAR(512),
|
||||
"buy_this_url" VARCHAR(512),
|
||||
"isrc_number" VARCHAR(512),
|
||||
"catalog_number" VARCHAR(512),
|
||||
"original_artist" VARCHAR(512),
|
||||
"copyright" VARCHAR(512),
|
||||
"report_datetime" VARCHAR(32),
|
||||
"report_location" VARCHAR(512),
|
||||
"report_organization" VARCHAR(512),
|
||||
"subject" VARCHAR(512),
|
||||
"contributor" VARCHAR(512),
|
||||
"language" VARCHAR(512),
|
||||
"file_exists" BOOLEAN DEFAULT 't',
|
||||
"replay_gain" NUMERIC,
|
||||
"owner_id" INTEGER,
|
||||
"cuein" interval DEFAULT '00:00:00',
|
||||
"cueout" interval DEFAULT '00:00:00',
|
||||
"silan_check" BOOLEAN DEFAULT 'f',
|
||||
"hidden" BOOLEAN DEFAULT 'f',
|
||||
"is_scheduled" BOOLEAN DEFAULT 'f',
|
||||
"is_playlist" BOOLEAN DEFAULT 'f',
|
||||
"filesize" INTEGER DEFAULT 0 NOT NULL,
|
||||
"description" VARCHAR(512),
|
||||
"artwork" VARCHAR(512),
|
||||
"track_type" VARCHAR(16),
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
CREATE INDEX "cc_files_md5_idx" ON "cc_files" ("md5");
|
||||
|
||||
CREATE INDEX "cc_files_name_idx" ON "cc_files" ("name");
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_track_types
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_track_types" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_track_types"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"code" VARCHAR(16) DEFAULT '' NOT NULL,
|
||||
"visibility" BOOLEAN DEFAULT 't' NOT NULL,
|
||||
"type_name" VARCHAR(64) DEFAULT '' NOT NULL,
|
||||
"description" VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
PRIMARY KEY ("id"),
|
||||
CONSTRAINT "cc_track_types_id_idx" UNIQUE ("id"),
|
||||
CONSTRAINT "cc_track_types_code_idx" UNIQUE ("code")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cloud_file
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cloud_file" CASCADE;
|
||||
|
||||
CREATE TABLE "cloud_file"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"storage_backend" VARCHAR(512) NOT NULL,
|
||||
"resource_id" TEXT NOT NULL,
|
||||
"cc_file_id" INTEGER,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_perms
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_perms" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_perms"
|
||||
(
|
||||
"permid" INTEGER NOT NULL,
|
||||
"subj" INTEGER,
|
||||
"action" VARCHAR(20),
|
||||
"obj" INTEGER,
|
||||
"type" CHAR(1),
|
||||
PRIMARY KEY ("permid"),
|
||||
CONSTRAINT "cc_perms_all_idx" UNIQUE ("subj","action","obj"),
|
||||
CONSTRAINT "cc_perms_permid_idx" UNIQUE ("permid")
|
||||
);
|
||||
|
||||
CREATE INDEX "cc_perms_subj_obj_idx" ON "cc_perms" ("subj","obj");
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_show
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_show" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_show"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"name" VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
"url" VARCHAR(255) DEFAULT '',
|
||||
"genre" VARCHAR(255) DEFAULT '',
|
||||
"description" VARCHAR(8192),
|
||||
"color" VARCHAR(6),
|
||||
"background_color" VARCHAR(6),
|
||||
"live_stream_using_airtime_auth" BOOLEAN DEFAULT 'f',
|
||||
"live_stream_using_custom_auth" BOOLEAN DEFAULT 'f',
|
||||
"live_stream_user" VARCHAR(255),
|
||||
"live_stream_pass" VARCHAR(255),
|
||||
"linked" BOOLEAN DEFAULT 'f' NOT NULL,
|
||||
"is_linkable" BOOLEAN DEFAULT 't' NOT NULL,
|
||||
"image_path" VARCHAR(255) DEFAULT '',
|
||||
"has_autoplaylist" BOOLEAN DEFAULT 'f' NOT NULL,
|
||||
"autoplaylist_id" INTEGER,
|
||||
"autoplaylist_repeat" BOOLEAN DEFAULT 'f' NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_show_instances
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_show_instances" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_show_instances"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"description" VARCHAR(8192) DEFAULT '',
|
||||
"starts" TIMESTAMP NOT NULL,
|
||||
"ends" TIMESTAMP NOT NULL,
|
||||
"show_id" INTEGER NOT NULL,
|
||||
"record" INT2 DEFAULT 0,
|
||||
"rebroadcast" INT2 DEFAULT 0,
|
||||
"instance_id" INTEGER,
|
||||
"file_id" INTEGER,
|
||||
"time_filled" interval DEFAULT '00:00:00',
|
||||
"created" TIMESTAMP NOT NULL,
|
||||
"last_scheduled" TIMESTAMP,
|
||||
"modified_instance" BOOLEAN DEFAULT 'f' NOT NULL,
|
||||
"autoplaylist_built" BOOLEAN DEFAULT 'f' NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_show_days
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_show_days" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_show_days"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"first_show" DATE NOT NULL,
|
||||
"last_show" DATE,
|
||||
"start_time" TIME NOT NULL,
|
||||
"timezone" VARCHAR NOT NULL,
|
||||
"duration" VARCHAR NOT NULL,
|
||||
"day" INT2,
|
||||
"repeat_type" INT2 NOT NULL,
|
||||
"next_pop_date" DATE,
|
||||
"show_id" INTEGER NOT NULL,
|
||||
"record" INT2 DEFAULT 0,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_show_rebroadcast
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_show_rebroadcast" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_show_rebroadcast"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"day_offset" VARCHAR NOT NULL,
|
||||
"start_time" TIME NOT NULL,
|
||||
"show_id" INTEGER NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_show_hosts
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_show_hosts" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_show_hosts"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"show_id" INTEGER NOT NULL,
|
||||
"subjs_id" INTEGER NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_playlist
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_playlist" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_playlist"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"name" VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
"mtime" TIMESTAMP(6),
|
||||
"utime" TIMESTAMP(6),
|
||||
"creator_id" INTEGER,
|
||||
"description" VARCHAR(512),
|
||||
"length" interval DEFAULT '00:00:00',
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_playlistcontents
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_playlistcontents" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_playlistcontents"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"playlist_id" INTEGER,
|
||||
"file_id" INTEGER,
|
||||
"block_id" INTEGER,
|
||||
"stream_id" INTEGER,
|
||||
"type" INT2 DEFAULT 0 NOT NULL,
|
||||
"position" INTEGER,
|
||||
"trackoffset" FLOAT DEFAULT 0 NOT NULL,
|
||||
"cliplength" interval DEFAULT '00:00:00',
|
||||
"cuein" interval DEFAULT '00:00:00',
|
||||
"cueout" interval DEFAULT '00:00:00',
|
||||
"fadein" TIME DEFAULT '00:00:00',
|
||||
"fadeout" TIME DEFAULT '00:00:00',
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_block
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_block" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_block"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"name" VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
"mtime" TIMESTAMP(6),
|
||||
"utime" TIMESTAMP(6),
|
||||
"creator_id" INTEGER,
|
||||
"description" VARCHAR(512),
|
||||
"length" interval DEFAULT '00:00:00',
|
||||
"type" VARCHAR(7) DEFAULT 'dynamic',
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_blockcontents
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_blockcontents" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_blockcontents"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"block_id" INTEGER,
|
||||
"file_id" INTEGER,
|
||||
"position" INTEGER,
|
||||
"trackoffset" FLOAT DEFAULT 0 NOT NULL,
|
||||
"cliplength" interval DEFAULT '00:00:00',
|
||||
"cuein" interval DEFAULT '00:00:00',
|
||||
"cueout" interval DEFAULT '00:00:00',
|
||||
"fadein" TIME DEFAULT '00:00:00',
|
||||
"fadeout" TIME DEFAULT '00:00:00',
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_blockcriteria
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_blockcriteria" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_blockcriteria"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"criteria" VARCHAR(32) NOT NULL,
|
||||
"modifier" VARCHAR(16) NOT NULL,
|
||||
"value" VARCHAR(512) NOT NULL,
|
||||
"extra" VARCHAR(512),
|
||||
"criteriagroup" INTEGER,
|
||||
"block_id" INTEGER NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_pref
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_pref" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_pref"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"subjid" INTEGER,
|
||||
"keystr" VARCHAR(255),
|
||||
"valstr" TEXT,
|
||||
PRIMARY KEY ("id"),
|
||||
CONSTRAINT "cc_pref_id_idx" UNIQUE ("id"),
|
||||
CONSTRAINT "cc_pref_subj_key_idx" UNIQUE ("subjid","keystr")
|
||||
);
|
||||
|
||||
CREATE INDEX "cc_pref_subjid_idx" ON "cc_pref" ("subjid");
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_schedule
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_schedule" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_schedule"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"starts" TIMESTAMP NOT NULL,
|
||||
"ends" TIMESTAMP NOT NULL,
|
||||
"file_id" INTEGER,
|
||||
"stream_id" INTEGER,
|
||||
"clip_length" interval DEFAULT '00:00:00',
|
||||
"fade_in" TIME DEFAULT '00:00:00',
|
||||
"fade_out" TIME DEFAULT '00:00:00',
|
||||
"cue_in" interval NOT NULL,
|
||||
"cue_out" interval NOT NULL,
|
||||
"media_item_played" BOOLEAN DEFAULT 'f',
|
||||
"instance_id" INTEGER NOT NULL,
|
||||
"playout_status" INT2 DEFAULT 1 NOT NULL,
|
||||
"broadcasted" INT2 DEFAULT 0 NOT NULL,
|
||||
"position" INTEGER DEFAULT 0 NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
CREATE INDEX "cc_schedule_instance_id_idx" ON "cc_schedule" ("instance_id");
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_sess
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_sess" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_sess"
|
||||
(
|
||||
"sessid" CHAR(32) NOT NULL,
|
||||
"userid" INTEGER,
|
||||
"login" VARCHAR(255),
|
||||
"ts" TIMESTAMP,
|
||||
PRIMARY KEY ("sessid")
|
||||
);
|
||||
|
||||
CREATE INDEX "cc_sess_login_idx" ON "cc_sess" ("login");
|
||||
|
||||
CREATE INDEX "cc_sess_userid_idx" ON "cc_sess" ("userid");
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_subjs
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_subjs" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_subjs"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"login" VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
"pass" VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
"type" CHAR(1) DEFAULT 'U' NOT NULL,
|
||||
"first_name" VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
"last_name" VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
"lastlogin" TIMESTAMP,
|
||||
"lastfail" TIMESTAMP,
|
||||
"skype_contact" VARCHAR,
|
||||
"jabber_contact" VARCHAR,
|
||||
"email" VARCHAR,
|
||||
"cell_phone" VARCHAR,
|
||||
"login_attempts" INTEGER DEFAULT 0,
|
||||
PRIMARY KEY ("id"),
|
||||
CONSTRAINT "cc_subjs_id_idx" UNIQUE ("id"),
|
||||
CONSTRAINT "cc_subjs_login_idx" UNIQUE ("login")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_subjs_token
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_subjs_token" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_subjs_token"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"user_id" INTEGER NOT NULL,
|
||||
"action" VARCHAR(255) NOT NULL,
|
||||
"token" VARCHAR(40) NOT NULL,
|
||||
"created" TIMESTAMP NOT NULL,
|
||||
PRIMARY KEY ("id"),
|
||||
CONSTRAINT "cc_subjs_token_idx" UNIQUE ("token")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_country
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_country" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_country"
|
||||
(
|
||||
"isocode" CHAR(3) NOT NULL,
|
||||
"name" VARCHAR(255) NOT NULL,
|
||||
PRIMARY KEY ("isocode")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_stream_setting
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_stream_setting" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_stream_setting"
|
||||
(
|
||||
"keyname" VARCHAR(64) NOT NULL,
|
||||
"value" VARCHAR(255),
|
||||
"type" VARCHAR(16) NOT NULL,
|
||||
PRIMARY KEY ("keyname")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_login_attempts
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_login_attempts" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_login_attempts"
|
||||
(
|
||||
"ip" VARCHAR(32) NOT NULL,
|
||||
"attempts" INTEGER DEFAULT 0,
|
||||
PRIMARY KEY ("ip")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_service_register
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_service_register" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_service_register"
|
||||
(
|
||||
"name" VARCHAR(32) NOT NULL,
|
||||
"ip" VARCHAR(45) NOT NULL,
|
||||
PRIMARY KEY ("name")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_live_log
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_live_log" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_live_log"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"state" VARCHAR(32) NOT NULL,
|
||||
"start_time" TIMESTAMP NOT NULL,
|
||||
"end_time" TIMESTAMP,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_webstream
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_webstream" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_webstream"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"name" VARCHAR(255) NOT NULL,
|
||||
"description" VARCHAR(255) NOT NULL,
|
||||
"url" VARCHAR(512) NOT NULL,
|
||||
"length" interval DEFAULT '00:00:00' NOT NULL,
|
||||
"creator_id" INTEGER NOT NULL,
|
||||
"mtime" TIMESTAMP(6) NOT NULL,
|
||||
"utime" TIMESTAMP(6) NOT NULL,
|
||||
"lptime" TIMESTAMP(6),
|
||||
"mime" VARCHAR,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_webstream_metadata
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_webstream_metadata" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_webstream_metadata"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"instance_id" INTEGER NOT NULL,
|
||||
"start_time" TIMESTAMP NOT NULL,
|
||||
"liquidsoap_data" VARCHAR(1024) NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_mount_name
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_mount_name" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_mount_name"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"mount_name" VARCHAR NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_timestamp
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_timestamp" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_timestamp"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"timestamp" TIMESTAMP NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_listener_count
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_listener_count" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_listener_count"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"timestamp_id" INTEGER NOT NULL,
|
||||
"mount_name_id" INTEGER NOT NULL,
|
||||
"listener_count" INTEGER NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_playout_history
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_playout_history" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_playout_history"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"file_id" INTEGER,
|
||||
"starts" TIMESTAMP NOT NULL,
|
||||
"ends" TIMESTAMP,
|
||||
"instance_id" INTEGER,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_playout_history_metadata
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_playout_history_metadata" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_playout_history_metadata"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"history_id" INTEGER NOT NULL,
|
||||
"key" VARCHAR(128) NOT NULL,
|
||||
"value" VARCHAR(128) NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_playout_history_template
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_playout_history_template" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_playout_history_template"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"name" VARCHAR(128) NOT NULL,
|
||||
"type" VARCHAR(35) NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_playout_history_template_field
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_playout_history_template_field" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_playout_history_template_field"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"template_id" INTEGER NOT NULL,
|
||||
"name" VARCHAR(128) NOT NULL,
|
||||
"label" VARCHAR(128) NOT NULL,
|
||||
"type" VARCHAR(128) NOT NULL,
|
||||
"is_file_md" BOOLEAN DEFAULT 'f' NOT NULL,
|
||||
"position" INTEGER NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- third_party_track_references
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "third_party_track_references" CASCADE;
|
||||
|
||||
CREATE TABLE "third_party_track_references"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"service" VARCHAR(256) NOT NULL,
|
||||
"foreign_id" VARCHAR(256),
|
||||
"file_id" INTEGER DEFAULT 0 NOT NULL,
|
||||
"upload_time" TIMESTAMP,
|
||||
"status" VARCHAR(256),
|
||||
PRIMARY KEY ("id"),
|
||||
CONSTRAINT "foreign_id_unique" UNIQUE ("foreign_id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- celery_tasks
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "celery_tasks" CASCADE;
|
||||
|
||||
CREATE TABLE "celery_tasks"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"task_id" VARCHAR(256) NOT NULL,
|
||||
"track_reference" INTEGER NOT NULL,
|
||||
"name" VARCHAR(256),
|
||||
"dispatch_time" TIMESTAMP,
|
||||
"status" VARCHAR(256) NOT NULL,
|
||||
PRIMARY KEY ("id"),
|
||||
CONSTRAINT "id_unique" UNIQUE ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- podcast
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "podcast" CASCADE;
|
||||
|
||||
CREATE TABLE "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
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "station_podcast" CASCADE;
|
||||
|
||||
CREATE TABLE "station_podcast"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"podcast_id" INTEGER NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- imported_podcast
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "imported_podcast" CASCADE;
|
||||
|
||||
CREATE TABLE "imported_podcast"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"auto_ingest" BOOLEAN DEFAULT 'f' NOT NULL,
|
||||
"auto_ingest_timestamp" TIMESTAMP,
|
||||
"album_override" BOOLEAN DEFAULT 'f' NOT NULL,
|
||||
"podcast_id" INTEGER NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- podcast_episodes
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "podcast_episodes" CASCADE;
|
||||
|
||||
CREATE TABLE "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,
|
||||
"episode_title" VARCHAR(4096) NOT NULL,
|
||||
"episode_description" TEXT NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
ALTER TABLE "cc_files" ADD CONSTRAINT "cc_files_owner_fkey"
|
||||
FOREIGN KEY ("owner_id")
|
||||
REFERENCES "cc_subjs" ("id");
|
||||
|
||||
ALTER TABLE "cc_files" ADD CONSTRAINT "cc_files_editedby_fkey"
|
||||
FOREIGN KEY ("editedby")
|
||||
REFERENCES "cc_subjs" ("id");
|
||||
|
||||
ALTER TABLE "cc_files" ADD CONSTRAINT "cc_music_dirs_folder_fkey"
|
||||
FOREIGN KEY ("directory")
|
||||
REFERENCES "cc_music_dirs" ("id");
|
||||
|
||||
ALTER TABLE "cloud_file" ADD CONSTRAINT "cloud_file_FK_1"
|
||||
FOREIGN KEY ("cc_file_id")
|
||||
REFERENCES "cc_files" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_perms" ADD CONSTRAINT "cc_perms_subj_fkey"
|
||||
FOREIGN KEY ("subj")
|
||||
REFERENCES "cc_subjs" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_show" ADD CONSTRAINT "cc_playlist_autoplaylist_fkey"
|
||||
FOREIGN KEY ("autoplaylist_id")
|
||||
REFERENCES "cc_playlist" ("id")
|
||||
ON DELETE SET NULL;
|
||||
|
||||
ALTER TABLE "cc_show_instances" ADD CONSTRAINT "cc_show_fkey"
|
||||
FOREIGN KEY ("show_id")
|
||||
REFERENCES "cc_show" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_show_instances" ADD CONSTRAINT "cc_original_show_instance_fkey"
|
||||
FOREIGN KEY ("instance_id")
|
||||
REFERENCES "cc_show_instances" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_show_instances" ADD CONSTRAINT "cc_recorded_file_fkey"
|
||||
FOREIGN KEY ("file_id")
|
||||
REFERENCES "cc_files" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_show_days" ADD CONSTRAINT "cc_show_fkey"
|
||||
FOREIGN KEY ("show_id")
|
||||
REFERENCES "cc_show" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_show_rebroadcast" ADD CONSTRAINT "cc_show_fkey"
|
||||
FOREIGN KEY ("show_id")
|
||||
REFERENCES "cc_show" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_show_hosts" ADD CONSTRAINT "cc_perm_show_fkey"
|
||||
FOREIGN KEY ("show_id")
|
||||
REFERENCES "cc_show" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_show_hosts" ADD CONSTRAINT "cc_perm_host_fkey"
|
||||
FOREIGN KEY ("subjs_id")
|
||||
REFERENCES "cc_subjs" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_playlist" ADD CONSTRAINT "cc_playlist_createdby_fkey"
|
||||
FOREIGN KEY ("creator_id")
|
||||
REFERENCES "cc_subjs" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_playlistcontents" ADD CONSTRAINT "cc_playlistcontents_file_id_fkey"
|
||||
FOREIGN KEY ("file_id")
|
||||
REFERENCES "cc_files" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_playlistcontents" ADD CONSTRAINT "cc_playlistcontents_block_id_fkey"
|
||||
FOREIGN KEY ("block_id")
|
||||
REFERENCES "cc_block" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_playlistcontents" ADD CONSTRAINT "cc_playlistcontents_playlist_id_fkey"
|
||||
FOREIGN KEY ("playlist_id")
|
||||
REFERENCES "cc_playlist" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_block" ADD CONSTRAINT "cc_block_createdby_fkey"
|
||||
FOREIGN KEY ("creator_id")
|
||||
REFERENCES "cc_subjs" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_blockcontents" ADD CONSTRAINT "cc_blockcontents_file_id_fkey"
|
||||
FOREIGN KEY ("file_id")
|
||||
REFERENCES "cc_files" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_blockcontents" ADD CONSTRAINT "cc_blockcontents_block_id_fkey"
|
||||
FOREIGN KEY ("block_id")
|
||||
REFERENCES "cc_block" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_blockcriteria" ADD CONSTRAINT "cc_blockcontents_block_id_fkey"
|
||||
FOREIGN KEY ("block_id")
|
||||
REFERENCES "cc_block" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_pref" ADD CONSTRAINT "cc_pref_subjid_fkey"
|
||||
FOREIGN KEY ("subjid")
|
||||
REFERENCES "cc_subjs" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_schedule" ADD CONSTRAINT "cc_show_inst_fkey"
|
||||
FOREIGN KEY ("instance_id")
|
||||
REFERENCES "cc_show_instances" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_schedule" ADD CONSTRAINT "cc_show_file_fkey"
|
||||
FOREIGN KEY ("file_id")
|
||||
REFERENCES "cc_files" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_schedule" ADD CONSTRAINT "cc_show_stream_fkey"
|
||||
FOREIGN KEY ("stream_id")
|
||||
REFERENCES "cc_webstream" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_sess" ADD CONSTRAINT "cc_sess_userid_fkey"
|
||||
FOREIGN KEY ("userid")
|
||||
REFERENCES "cc_subjs" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_subjs_token" ADD CONSTRAINT "cc_subjs_token_userid_fkey"
|
||||
FOREIGN KEY ("user_id")
|
||||
REFERENCES "cc_subjs" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_webstream_metadata" ADD CONSTRAINT "cc_schedule_inst_fkey"
|
||||
FOREIGN KEY ("instance_id")
|
||||
REFERENCES "cc_schedule" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_listener_count" ADD CONSTRAINT "cc_timestamp_inst_fkey"
|
||||
FOREIGN KEY ("timestamp_id")
|
||||
REFERENCES "cc_timestamp" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_listener_count" ADD CONSTRAINT "cc_mount_name_inst_fkey"
|
||||
FOREIGN KEY ("mount_name_id")
|
||||
REFERENCES "cc_mount_name" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_playout_history" ADD CONSTRAINT "cc_playout_history_file_tag_fkey"
|
||||
FOREIGN KEY ("file_id")
|
||||
REFERENCES "cc_files" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_playout_history" ADD CONSTRAINT "cc_his_item_inst_fkey"
|
||||
FOREIGN KEY ("instance_id")
|
||||
REFERENCES "cc_show_instances" ("id")
|
||||
ON DELETE SET NULL;
|
||||
|
||||
ALTER TABLE "cc_playout_history_metadata" ADD CONSTRAINT "cc_playout_history_metadata_entry_fkey"
|
||||
FOREIGN KEY ("history_id")
|
||||
REFERENCES "cc_playout_history" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_playout_history_template_field" ADD CONSTRAINT "cc_playout_history_template_template_fkey"
|
||||
FOREIGN KEY ("template_id")
|
||||
REFERENCES "cc_playout_history_template" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "third_party_track_references" ADD CONSTRAINT "track_reference_fkey"
|
||||
FOREIGN KEY ("file_id")
|
||||
REFERENCES "cc_files" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "celery_tasks" ADD CONSTRAINT "celery_service_fkey"
|
||||
FOREIGN KEY ("track_reference")
|
||||
REFERENCES "third_party_track_references" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
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;
|
|
@ -1,7 +0,0 @@
|
|||
DROP SEQUENCE IF EXISTS schedule_group_id_seq CASCADE;
|
||||
|
||||
CREATE SEQUENCE schedule_group_id_seq;
|
||||
|
||||
DROP SEQUENCE IF EXISTS show_group_id_seq CASCADE;
|
||||
|
||||
CREATE SEQUENCE show_group_id_seq;
|
|
@ -1,6 +0,0 @@
|
|||
# Sqlfile -> Database map
|
||||
schema.sql=airtime
|
||||
sequences.sql=campcaster
|
||||
views.sql=campcaster
|
||||
triggers.sql=campcaster
|
||||
defaultdata.sql=campcaster
|
|
@ -1,6 +0,0 @@
|
|||
----------------------------------------------------------------------------------
|
||||
-- calculate_position()
|
||||
----------------------------------------------------------------------------------
|
||||
DROP FUNCTION IF EXISTS calculate_position CASCADE;
|
||||
|
||||
-- remove this trigger for group adds/delete
|
|
@ -1,5 +0,0 @@
|
|||
-------------------------------------------------------
|
||||
-- cc_playlisttimes
|
||||
-------------------------------------------------------
|
||||
|
||||
DROP VIEW IF EXISTS cc_playlisttimes;
|
|
@ -167,23 +167,17 @@ class DatabaseSetup extends Setup
|
|||
*/
|
||||
private function createDatabaseTables()
|
||||
{
|
||||
$sqlDir = dirname(__DIR__, 2) . '/build/sql/';
|
||||
$files = ['schema.sql', 'sequences.sql', 'views.sql', 'triggers.sql', 'defaultdata.sql'];
|
||||
foreach ($files as $f) {
|
||||
$sqlDir = dirname(ROOT_PATH) . '/api/libretime_api/legacy/migrations/sql/';
|
||||
$files = ['schema.sql', 'data.sql'];
|
||||
foreach ($files as $file) {
|
||||
try {
|
||||
/*
|
||||
* Unfortunately, we need to use exec here due to PDO's lack of support for importing
|
||||
* multi-line .sql files. PDO->exec() almost works, but any SQL errors stop the import,
|
||||
* so the necessary DROPs on non-existent tables make it unusable. Prepared statements
|
||||
* have multiple issues; they similarly die on any SQL errors, fail to read in multi-line
|
||||
* commands, and fail on any unescaped ? or $ characters.
|
||||
*/
|
||||
exec('export PGPASSWORD=' . self::$_properties['password'] . ' && /usr/bin/psql -U ' . self::$_properties['user']
|
||||
. ' --dbname ' . self::$_properties['name'] . ' -h ' . self::$_properties['host']
|
||||
. " -f {$sqlDir}{$f} 2>/dev/null", $out, $status);
|
||||
} catch (Exception $e) {
|
||||
$sql = file_get_contents($sqlDir . $file);
|
||||
self::$dbh->exec($sql);
|
||||
} catch (PDOException $e) {
|
||||
echo $e->getMessage();
|
||||
|
||||
throw new AirtimeDatabaseException(
|
||||
'There was an error setting up the Airtime schema!',
|
||||
'There was an error setting up the Airtime schema!: ' . $e->getMessage(),
|
||||
[self::DB_NAME]
|
||||
);
|
||||
}
|
||||
|
|
|
@ -214,30 +214,22 @@ class AirtimeInstall
|
|||
public static function CreateDatabaseTables($dbuser, $dbpasswd, $dbname, $dbhost, $dbport)
|
||||
{
|
||||
echo ' * Creating database tables' . PHP_EOL;
|
||||
// Put Propel sql files in Database
|
||||
// $command = AirtimeInstall::CONF_DIR_WWW."/library/propel/generator/bin/propel-gen ".AirtimeInstall::CONF_DIR_WWW."/build/ insert-sql 2>/dev/null";
|
||||
$dir = self::GetAirtimeSrcDir() . '/build/sql/';
|
||||
$files = ['schema.sql', 'sequences.sql', 'views.sql', 'triggers.sql', 'defaultdata.sql'];
|
||||
foreach ($files as $f) {
|
||||
$command = <<<"END"
|
||||
PGPASSWORD={$dbpasswd} \\
|
||||
/usr/bin/psql \\
|
||||
--host={$dbhost} \\
|
||||
--port={$dbport} \\
|
||||
--dbname={$dbname} \\
|
||||
--username={$dbuser} \\
|
||||
--file {$dir}{$f} 2>&1
|
||||
END;
|
||||
@exec($command, $output, $results);
|
||||
$con = Propel::getConnection();
|
||||
$sqlDir = dirname(ROOT_PATH) . '/api/libretime_api/legacy/migrations/sql/';
|
||||
$files = ['schema.sql', 'data.sql'];
|
||||
foreach ($files as $file) {
|
||||
try {
|
||||
$sql = file_get_contents($sqlDir . $file);
|
||||
$con->exec($sql);
|
||||
} catch (PDOException $e) {
|
||||
echo $e->getMessage();
|
||||
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
AirtimeInstall::$databaseTablesCreated = true;
|
||||
}
|
||||
|
||||
final public static function UpdateDatabaseTables()
|
||||
{
|
||||
UpgradeManager::doUpgrade();
|
||||
}
|
||||
|
||||
public static function SetAirtimeVersion($p_version)
|
||||
{
|
||||
$con = Propel::getConnection();
|
||||
|
|
|
@ -126,7 +126,6 @@ class TestHelper
|
|||
} else {
|
||||
// Create all the database tables
|
||||
AirtimeInstall::CreateDatabaseTables($dbuser, $dbpasswd, $dbname, $dbhost, $dbport);
|
||||
AirtimeInstall::UpdateDatabaseTables();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue