<?xml version="1.0" encoding="utf-8"?>
<!--Autogenerated by PropelSchemaReverseTask class.-->
<database name="airtime" defaultIdMethod="native">
  <table name="cc_files" phpName="CcFiles">
    <column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true" />
    <column name="name" phpName="DbName" type="VARCHAR" size="255" required="true" defaultValue="" />
    <column name="mime" phpName="DbMime" type="VARCHAR" size="255" required="true" defaultValue="" />
    <column name="ftype" phpName="DbFtype" type="VARCHAR" size="128" required="true" defaultValue="" />
    <column name="filepath" phpName="DbFilepath" type="LONGVARCHAR" required="false" defaultValue="" />
    <column name="import_status" phpName="DbImportStatus" type="INTEGER" required="true" defaultValue="1" />
    <column name="currentlyaccessing" phpName="DbCurrentlyaccessing" type="INTEGER" required="true" defaultValue="0" />
    <column name="editedby" phpName="DbEditedby" type="INTEGER" required="false" />
    <column name="mtime" phpName="DbMtime" type="TIMESTAMP" size="6" required="false" />
    <column name="utime" phpName="DbUtime" type="TIMESTAMP" size="6" required="false" />
    <column name="lptime" phpName="DbLPtime" type="TIMESTAMP" size="6" required="false" />
    <column name="md5" phpName="DbMd5" type="CHAR" size="32" required="false" />
    <column name="track_title" phpName="DbTrackTitle" type="VARCHAR" size="512" required="false" />
    <column name="artist_name" phpName="DbArtistName" type="VARCHAR" size="512" required="false" />
    <column name="bit_rate" phpName="DbBitRate" type="INTEGER" required="false" />
    <column name="sample_rate" phpName="DbSampleRate" type="INTEGER" required="false" />
    <column name="format" phpName="DbFormat" type="VARCHAR" size="128" required="false" />
    <column name="length" phpName="DbLength" type="VARCHAR" sqlType="interval" defaultValue="00:00:00" required="false" />
    <column name="album_title" phpName="DbAlbumTitle" type="VARCHAR" size="512" required="false" />
    <column name="genre" phpName="DbGenre" type="VARCHAR" size="64" required="false" />
    <column name="comments" phpName="DbComments" type="LONGVARCHAR" required="false" />
    <column name="year" phpName="DbYear" type="VARCHAR" size="16" required="false" />
    <column name="track_number" phpName="DbTrackNumber" type="INTEGER" required="false" />
    <column name="channels" phpName="DbChannels" type="INTEGER" required="false" />
    <column name="url" phpName="DbUrl" type="VARCHAR" size="1024" required="false" />
    <column name="bpm" phpName="DbBpm" type="INTEGER" required="false" />
    <column name="rating" phpName="DbRating" type="VARCHAR" size="8" required="false" />
    <column name="encoded_by" phpName="DbEncodedBy" type="VARCHAR" size="255" required="false" />
    <column name="disc_number" phpName="DbDiscNumber" type="VARCHAR" size="8" required="false" />
    <column name="mood" phpName="DbMood" type="VARCHAR" size="64" required="false" />
    <column name="label" phpName="DbLabel" type="VARCHAR" size="512" required="false" />
    <column name="composer" phpName="DbComposer" type="VARCHAR" size="512" required="false" />
    <column name="encoder" phpName="DbEncoder" type="VARCHAR" size="64" required="false" />
    <column name="checksum" phpName="DbChecksum" type="VARCHAR" size="256" required="false" />
    <column name="lyrics" phpName="DbLyrics" type="LONGVARCHAR" required="false" />
    <column name="orchestra" phpName="DbOrchestra" type="VARCHAR" size="512" required="false" />
    <column name="conductor" phpName="DbConductor" type="VARCHAR" size="512" required="false" />
    <column name="lyricist" phpName="DbLyricist" type="VARCHAR" size="512" required="false" />
    <column name="original_lyricist" phpName="DbOriginalLyricist" type="VARCHAR" size="512" required="false" />
    <column name="radio_station_name" phpName="DbRadioStationName" type="VARCHAR" size="512" required="false" />
    <column name="info_url" phpName="DbInfoUrl" type="VARCHAR" size="512" required="false" />
    <column name="artist_url" phpName="DbArtistUrl" type="VARCHAR" size="512" required="false" />
    <column name="audio_source_url" phpName="DbAudioSourceUrl" type="VARCHAR" size="512" required="false" />
    <column name="radio_station_url" phpName="DbRadioStationUrl" type="VARCHAR" size="512" required="false" />
    <column name="buy_this_url" phpName="DbBuyThisUrl" type="VARCHAR" size="512" required="false" />
    <column name="isrc_number" phpName="DbIsrcNumber" type="VARCHAR" size="512" required="false" />
    <column name="catalog_number" phpName="DbCatalogNumber" type="VARCHAR" size="512" required="false" />
    <column name="original_artist" phpName="DbOriginalArtist" type="VARCHAR" size="512" required="false" />
    <column name="copyright" phpName="DbCopyright" type="VARCHAR" size="512" required="false" />
    <column name="report_datetime" phpName="DbReportDatetime" type="VARCHAR" size="32" required="false" />
    <column name="report_location" phpName="DbReportLocation" type="VARCHAR" size="512" required="false" />
    <column name="report_organization" phpName="DbReportOrganization" type="VARCHAR" size="512" required="false" />
    <column name="subject" phpName="DbSubject" type="VARCHAR" size="512" required="false" />
    <column name="contributor" phpName="DbContributor" type="VARCHAR" size="512" required="false" />
    <column name="language" phpName="DbLanguage" type="VARCHAR" size="512" required="false" />
    <column name="file_exists" phpName="DbFileExists" type="BOOLEAN" required="false" defaultValue="true" />
    <column name="replay_gain" phpName="DbReplayGain" type="NUMERIC" required="false" />
    <column name="owner_id" phpName="DbOwnerId" type="INTEGER" required="false" />
    <column name="cuein" phpName="DbCuein" type="VARCHAR" sqlType="interval" required="false" defaultValue="00:00:00" />
    <column name="cueout" phpName="DbCueout" type="VARCHAR" sqlType="interval" required="false" defaultValue="00:00:00" />
    <column name="silan_check" phpName="DbSilanCheck" type="BOOLEAN" defaultValue="false" />
    <column name="hidden" phpName="DbHidden" type="BOOLEAN" defaultValue="false" />
    <column name="is_scheduled" phpName="DbIsScheduled" type="BOOLEAN" defaultValue="false" />
    <column name="is_playlist" phpName="DbIsPlaylist" type="BOOLEAN" defaultValue="false" />
    <column name="filesize" phpName="DbFilesize" type="Integer" required="true" defaultValue="0" />
    <column name="description" phpName="DbDescription" type="VARCHAR" size="512" />
    <column name="artwork" phpName="DbArtwork" type="VARCHAR" size="4096" required="false" />
    <column name="track_type_id" phpName="DbTrackTypeId" type="INTEGER" required="false" />
    <foreign-key foreignTable="cc_subjs" phpName="FkOwner" name="cc_files_owner_fkey">
      <reference local="owner_id" foreign="id" />
    </foreign-key>
    <foreign-key foreignTable="cc_subjs" name="cc_files_editedby_fkey">
      <reference local="editedby" foreign="id" />
    </foreign-key>
    <foreign-key foreignTable="cc_track_types" name="cc_files_track_type_fkey">
      <reference local="track_type_id" foreign="id" />
    </foreign-key>
    <index name="cc_files_md5_idx">
      <index-column name="md5" />
    </index>
    <index name="cc_files_name_idx">
      <index-column name="name" />
    </index>
  </table>
  <table name="cc_track_types" phpName="CcTracktypes">
    <column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true" />
    <column name="code" phpName="DbCode" type="VARCHAR" size="16" required="true" defaultValue="" />
    <column name="visibility" phpName="DbVisibility" type="BOOLEAN" required="true" defaultValue="true" />
    <column name="type_name" phpName="DbTypeName" type="VARCHAR" size="64" required="true" defaultValue="" />
    <column name="description" phpName="DbDescription" type="VARCHAR" size="255" required="true" defaultValue="" />
    <column name="analyze_cue_points" phpName="DbAnalyzeCuePoints" type="BOOLEAN" required="true" defaultValue="false" />
    <unique name="cc_track_types_id_idx">
      <unique-column name="id" />
    </unique>
    <unique name="cc_track_types_code_idx">
      <unique-column name="code" />
    </unique>
  </table>
  <table name="cc_show" phpName="CcShow">
    <column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true" />
    <column name="name" phpName="DbName" type="VARCHAR" size="255" required="true" defaultValue="" />
    <column name="url" phpName="DbUrl" type="VARCHAR" size="255" required="false" defaultValue="" />
    <column name="genre" phpName="DbGenre" type="VARCHAR" size="255" required="false" defaultValue="" />
    <column name="description" phpName="DbDescription" type="VARCHAR" size="8192" required="false" />
    <column name="color" phpName="DbColor" type="VARCHAR" size="6" required="false" />
    <column name="background_color" phpName="DbBackgroundColor" type="VARCHAR" size="6" required="false" />
    <column name="live_stream_using_airtime_auth" phpName="DbLiveStreamUsingAirtimeAuth" type="BOOLEAN" required="false" defaultValue="false" />
    <column name="live_stream_using_custom_auth" phpName="DbLiveStreamUsingCustomAuth" type="BOOLEAN" required="false" defaultValue="false" />
    <column name="live_stream_user" phpName="DbLiveStreamUser" type="VARCHAR" size="255" required="false" />
    <column name="live_stream_pass" phpName="DbLiveStreamPass" type="VARCHAR" size="255" required="false" />
    <column name="linked" phpName="DbLinked" type="BOOLEAN" required="true" defaultValue="false" />
    <column name="is_linkable" phpName="DbIsLinkable" type="BOOLEAN" required="true" defaultValue="true" />
    <!-- A show is_linkable if it has never been linked before. Once a show becomes unlinked
         it can not be linked again -->
    <column name="image_path" phpName="DbImagePath" type="VARCHAR" size="255" required="false" defaultValue="" />
    <!-- Fully qualified path for the image associated with this show.
         Default is /path/to/stor/dir/:ownerId/show-images/:showId/imageName -->
    <column name="has_autoplaylist" phpName="DbHasAutoPlaylist" type="BOOLEAN" required="true" defaultValue="false" />
    <column name="autoplaylist_id" phpName="DbAutoPlaylistId" type="INTEGER" required="false" />
    <column name="autoplaylist_repeat" phpName="DbAutoPlaylistRepeat" type="BOOLEAN" required="true" defaultValue="false" />
    <foreign-key foreignTable="cc_playlist" name="cc_playlist_autoplaylist_fkey" onDelete="SETNULL">
      <reference local="autoplaylist_id" foreign="id" />
    </foreign-key>
  </table>
  <table name="cc_show_instances" phpName="CcShowInstances">
    <column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true" />
    <column name="description" phpName="DbDescription" type="VARCHAR" size="8192" required="false" defaultValue="" />
    <column name="starts" phpName="DbStarts" type="TIMESTAMP" required="true" />
    <column name="ends" phpName="DbEnds" type="TIMESTAMP" required="true" />
    <column name="show_id" phpName="DbShowId" type="INTEGER" required="true" />
    <column name="record" phpName="DbRecord" type="TINYINT" required="false" defaultValue="0" />
    <column name="rebroadcast" phpName="DbRebroadcast" type="TINYINT" required="false" defaultValue="0" />
    <column name="instance_id" phpName="DbOriginalShow" type="INTEGER" required="false" />
    <column name="file_id" phpName="DbRecordedFile" type="INTEGER" required="false" />
    <column name="time_filled" phpName="DbTimeFilled" type="VARCHAR" sqlType="interval" defaultValue="00:00:00" />
    <column name="created" phpName="DbCreated" type="TIMESTAMP" required="true" />
    <column name="last_scheduled" phpName="DbLastScheduled" type="TIMESTAMP" required="false" />
    <!-- The purpose of the modified_instance column is to mark a show instance that was
     deleted when it was part of repeating show. This is useful because the way shows work,
     instances can be regenerated if we edit the show, which is unwanted behaviour. This column serves
     to ensure that we don't regenerate the instance. -->
    <column name="modified_instance" phpName="DbModifiedInstance" type="BOOLEAN" required="true" defaultValue="false" />
    <column name="autoplaylist_built" phpName="DbAutoPlaylistBuilt" type="BOOLEAN" required="true" defaultValue="false" />
    <foreign-key foreignTable="cc_show" name="cc_show_fkey" onDelete="CASCADE">
      <reference local="show_id" foreign="id" />
    </foreign-key>
    <foreign-key foreignTable="cc_show_instances" name="cc_original_show_instance_fkey" onDelete="CASCADE">
      <reference local="instance_id" foreign="id" />
    </foreign-key>
    <foreign-key foreignTable="cc_files" name="cc_recorded_file_fkey" onDelete="CASCADE">
      <reference local="file_id" foreign="id" />
    </foreign-key>
  </table>
  <table name="cc_show_days" phpName="CcShowDays">
    <column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true" />
    <column name="first_show" phpName="DbFirstShow" type="DATE" required="true" />
    <column name="last_show" phpName="DbLastShow" type="DATE" required="false" />
    <column name="start_time" phpName="DbStartTime" type="TIME" required="true" />
    <column name="timezone" phpName="DbTimezone" type="VARCHAR" required="true" />
    <column name="duration" phpName="DbDuration" type="VARCHAR" required="true" />
    <column name="day" phpName="DbDay" type="TINYINT" required="false" />
    <column name="repeat_type" phpName="DbRepeatType" type="TINYINT" required="true" />
    <column name="next_pop_date" phpName="DbNextPopDate" type="DATE" required="false" />
    <column name="show_id" phpName="DbShowId" type="INTEGER" required="true" />
    <column name="record" phpName="DbRecord" type="TINYINT" required="false" defaultValue="0" />
    <foreign-key foreignTable="cc_show" name="cc_show_fkey" onDelete="CASCADE">
      <reference local="show_id" foreign="id" />
    </foreign-key>
  </table>
  <table name="cc_show_rebroadcast" phpName="CcShowRebroadcast">
    <column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true" />
    <column name="day_offset" phpName="DbDayOffset" type="VARCHAR" required="true" />
    <column name="start_time" phpName="DbStartTime" type="TIME" required="true" />
    <column name="show_id" phpName="DbShowId" type="INTEGER" required="true" />
    <foreign-key foreignTable="cc_show" name="cc_show_fkey" onDelete="CASCADE">
      <reference local="show_id" foreign="id" />
    </foreign-key>
  </table>
  <table name="cc_show_hosts" phpName="CcShowHosts">
    <column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true" />
    <column name="show_id" phpName="DbShow" type="INTEGER" required="true" />
    <column name="subjs_id" phpName="DbHost" type="INTEGER" required="true" />
    <foreign-key foreignTable="cc_show" name="cc_perm_show_fkey" onDelete="CASCADE">
      <reference local="show_id" foreign="id" />
    </foreign-key>
    <foreign-key foreignTable="cc_subjs" name="cc_perm_host_fkey" onDelete="CASCADE">
      <reference local="subjs_id" foreign="id" />
    </foreign-key>
  </table>
  <table name="cc_playlist" phpName="CcPlaylist">
    <column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true" />
    <column name="name" phpName="DbName" type="VARCHAR" size="255" required="true" defaultValue="" />
    <column name="mtime" phpName="DbMtime" type="TIMESTAMP" size="6" required="false" />
    <column name="utime" phpName="DbUtime" type="TIMESTAMP" size="6" required="false" />
    <column name="creator_id" phpName="DbCreatorId" type="INTEGER" required="false" />
    <column name="description" phpName="DbDescription" type="VARCHAR" size="512" required="false" />
    <column name="length" phpName="DbLength" type="VARCHAR" sqlType="interval" defaultValue="00:00:00" />
    <behavior name="aggregate_column">
      <parameter name="name" value="length" />
      <parameter name="foreign_table" value="cc_playlistcontents" />
      <parameter name="expression" value="SUM(cliplength)" />
    </behavior>
    <foreign-key foreignTable="cc_subjs" name="cc_playlist_createdby_fkey" onDelete="CASCADE">
      <reference local="creator_id" foreign="id" />
    </foreign-key>
  </table>
  <table name="cc_playlistcontents" phpName="CcPlaylistcontents">
    <column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true" />
    <column name="playlist_id" phpName="DbPlaylistId" type="INTEGER" required="false" />
    <column name="file_id" phpName="DbFileId" type="INTEGER" required="false" />
    <column name="block_id" phpName="DbBlockId" type="INTEGER" required="false" />
    <column name="stream_id" phpName="DbStreamId" type="INTEGER" required="false" />
    <!-- What type of item is stored in the playlist.
            0: audiotrack
            1: webstream
            2: block
            1: webstream
    -->
    <column name="type" phpName="DbType" type="SMALLINT" required="true" default="0" />
    <column name="position" phpName="DbPosition" type="INTEGER" required="false" />
    <column name="trackoffset" phpName="DbTrackOffset" type="REAL" required="true" default="0" />
    <column name="cliplength" phpName="DbCliplength" type="VARCHAR" sqlType="interval" required="false" defaultValue="00:00:00" />
    <column name="cuein" phpName="DbCuein" type="VARCHAR" sqlType="interval" required="false" defaultValue="00:00:00" />
    <column name="cueout" phpName="DbCueout" type="VARCHAR" sqlType="interval" required="false" defaultValue="00:00:00" />
    <column name="fadein" phpName="DbFadein" type="TIME" required="false" defaultValue="00:00:00" />
    <column name="fadeout" phpName="DbFadeout" type="TIME" required="false" defaultValue="00:00:00" />
    <foreign-key foreignTable="cc_files" name="cc_playlistcontents_file_id_fkey" onDelete="CASCADE">
      <reference local="file_id" foreign="id" />
    </foreign-key>
    <foreign-key foreignTable="cc_block" name="cc_playlistcontents_block_id_fkey" onDelete="CASCADE">
      <reference local="block_id" foreign="id" />
    </foreign-key>
    <foreign-key foreignTable="cc_playlist" name="cc_playlistcontents_playlist_id_fkey" onDelete="CASCADE">
      <reference local="playlist_id" foreign="id" />
    </foreign-key>
  </table>
  <table name="cc_block" phpName="CcBlock">
    <column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true" />
    <column name="name" phpName="DbName" type="VARCHAR" size="255" required="true" defaultValue="" />
    <column name="mtime" phpName="DbMtime" type="TIMESTAMP" size="6" required="false" />
    <column name="utime" phpName="DbUtime" type="TIMESTAMP" size="6" required="false" />
    <column name="creator_id" phpName="DbCreatorId" type="INTEGER" required="false" />
    <column name="description" phpName="DbDescription" type="VARCHAR" size="512" required="false" />
    <column name="length" phpName="DbLength" type="VARCHAR" sqlType="interval" defaultValue="00:00:00" />
    <column name="type" phpName="DbType" type="VARCHAR" size="7" defaultValue="dynamic" />
    <behavior name="aggregate_column">
      <parameter name="name" value="length" />
      <parameter name="foreign_table" value="cc_blockcontents" />
      <parameter name="expression" value="SUM(cliplength)" />
    </behavior>
    <foreign-key foreignTable="cc_subjs" name="cc_block_createdby_fkey" onDelete="CASCADE">
      <reference local="creator_id" foreign="id" />
    </foreign-key>
  </table>
  <table name="cc_blockcontents" phpName="CcBlockcontents">
    <column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true" />
    <column name="block_id" phpName="DbBlockId" type="INTEGER" required="false" />
    <column name="file_id" phpName="DbFileId" type="INTEGER" required="false" />
    <column name="position" phpName="DbPosition" type="INTEGER" required="false" />
    <column name="trackoffset" phpName="DbTrackOffset" type="REAL" required="true" default="0" />
    <column name="cliplength" phpName="DbCliplength" type="VARCHAR" sqlType="interval" required="false" defaultValue="00:00:00" />
    <column name="cuein" phpName="DbCuein" type="VARCHAR" sqlType="interval" required="false" defaultValue="00:00:00" />
    <column name="cueout" phpName="DbCueout" type="VARCHAR" sqlType="interval" required="false" defaultValue="00:00:00" />
    <column name="fadein" phpName="DbFadein" type="TIME" required="false" defaultValue="00:00:00" />
    <column name="fadeout" phpName="DbFadeout" type="TIME" required="false" defaultValue="00:00:00" />
    <foreign-key foreignTable="cc_files" name="cc_blockcontents_file_id_fkey" onDelete="CASCADE">
      <reference local="file_id" foreign="id" />
    </foreign-key>
    <foreign-key foreignTable="cc_block" name="cc_blockcontents_block_id_fkey" onDelete="CASCADE">
      <reference local="block_id" foreign="id" />
    </foreign-key>
  </table>
  <table name="cc_blockcriteria" phpName="CcBlockcriteria">
    <column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true" />
    <column name="criteria" phpName="DbCriteria" type="VARCHAR" size="32" required="true" />
    <column name="modifier" phpName="DbModifier" type="VARCHAR" size="16" required="true" />
    <column name="value" phpName="DbValue" type="VARCHAR" size="512" required="true" />
    <column name="extra" phpName="DbExtra" type="VARCHAR" size="512" required="false" />
    <column name="criteriagroup" phpName="DbCriteriaGroup" type="INTEGER" required="false" />
    <column name="block_id" phpName="DbBlockId" type="INTEGER" required="true" />
    <foreign-key foreignTable="cc_block" name="cc_blockcontents_block_id_fkey" onDelete="CASCADE">
      <reference local="block_id" foreign="id" />
    </foreign-key>
  </table>
  <table name="cc_pref" phpName="CcPref">
    <column name="id" phpName="Id" type="INTEGER" primaryKey="true" autoIncrement="true" required="true" />
    <column name="subjid" phpName="Subjid" type="INTEGER" required="false" />
    <column name="keystr" phpName="Keystr" type="VARCHAR" size="255" required="false" />
    <column name="valstr" phpName="Valstr" type="LONGVARCHAR" required="false" />
    <foreign-key foreignTable="cc_subjs" name="cc_pref_subjid_fkey" onDelete="CASCADE">
      <reference local="subjid" foreign="id" />
    </foreign-key>
    <unique name="cc_pref_id_idx">
      <unique-column name="id" />
    </unique>
    <unique name="cc_pref_subj_key_idx">
      <unique-column name="subjid" />
      <unique-column name="keystr" />
    </unique>
    <index name="cc_pref_subjid_idx">
      <index-column name="subjid" />
    </index>
  </table>
  <table name="cc_schedule" phpName="CcSchedule">
    <column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true" />
    <column name="starts" phpName="DbStarts" type="TIMESTAMP" required="true" />
    <column name="ends" phpName="DbEnds" type="TIMESTAMP" required="true" />
    <column name="file_id" phpName="DbFileId" type="INTEGER" required="false" />
    <column name="stream_id" phpName="DbStreamId" type="INTEGER" required="false" />
    <column name="clip_length" phpName="DbClipLength" type="VARCHAR" sqlType="interval" required="false" defaultValue="00:00:00" />
    <column name="fade_in" phpName="DbFadeIn" type="TIME" required="false" defaultValue="00:00:00" />
    <column name="fade_out" phpName="DbFadeOut" type="TIME" required="false" defaultValue="00:00:00" />
    <column name="cue_in" phpName="DbCueIn" type="VARCHAR" sqlType="interval" required="true" />
    <column name="cue_out" phpName="DbCueOut" type="VARCHAR" sqlType="interval" required="true" />
    <column name="media_item_played" phpName="DbMediaItemPlayed" type="BOOLEAN" required="false" defaultValue="0" />
    <column name="instance_id" phpName="DbInstanceId" type="INTEGER" required="true" />
    <column name="playout_status" phpName="DbPlayoutStatus" type="SMALLINT" required="true" defaultValue="1" />
    <column name="broadcasted" phpName="DbBroadcasted" type="SMALLINT" required="true" defaultValue="0" />
    <!-- Broadcasted is set to 1 when show and master source are not on.
         We need to know this for logging playout history. (It only gets logged when
         broadcasted = 1)
    -->
    <column name="position" phpName="DbPosition" type="INTEGER" required="true" default="0" />
    <!-- This foreign key is still useful even though it may seem we don't ever delete cc_show_instances anymore.
        We will do delete them in some cases (when editing a show and changing the repeating days of the week
        for example. \
        TLDR: Don't delete this foreign key constraint. -->
    <foreign-key foreignTable="cc_show_instances" name="cc_show_inst_fkey" onDelete="CASCADE">
      <reference local="instance_id" foreign="id" />
    </foreign-key>
    <foreign-key foreignTable="cc_files" name="cc_show_file_fkey" onDelete="CASCADE">
      <reference local="file_id" foreign="id" />
    </foreign-key>
    <foreign-key foreignTable="cc_webstream" name="cc_show_stream_fkey" onDelete="CASCADE">
      <reference local="stream_id" foreign="id" />
    </foreign-key>
    <index name="cc_schedule_instance_id_idx">
      <index-column name="instance_id" />
    </index>
  </table>
  <table name="cc_subjs" phpName="CcSubjs">
    <column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true" />
    <column name="login" phpName="DbLogin" type="VARCHAR" size="255" required="true" defaultValue="" />
    <column name="pass" phpName="DbPass" type="VARCHAR" size="255" required="true" defaultValue="" />
    <column name="type" phpName="DbType" type="CHAR" size="1" required="true" defaultValue="U" />
    <column name="first_name" phpName="DbFirstName" type="VARCHAR" size="255" required="true" defaultValue="" />
    <column name="last_name" phpName="DbLastName" type="VARCHAR" size="255" required="true" defaultValue="" />
    <column name="lastlogin" phpName="DbLastlogin" type="TIMESTAMP" required="false" />
    <column name="lastfail" phpName="DbLastfail" type="TIMESTAMP" required="false" />
    <column name="skype_contact" phpName="DbSkypeContact" type="VARCHAR" required="false" />
    <column name="jabber_contact" phpName="DbJabberContact" type="VARCHAR" required="false" />
    <column name="email" phpName="DbEmail" type="VARCHAR" required="false" />
    <column name="cell_phone" phpName="DbCellPhone" type="VARCHAR" required="false" />
    <column name="login_attempts" phpName="DbLoginAttempts" type="INTEGER" required="false" defaultValue="0" />
    <unique name="cc_subjs_id_idx">
      <unique-column name="id" />
    </unique>
    <unique name="cc_subjs_login_idx">
      <unique-column name="login" />
    </unique>
  </table>
  <table name="cc_subjs_token" phpName="CcSubjsToken">
    <column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true" />
    <column name="user_id" phpName="DbUserId" type="INTEGER" required="true" />
    <column name="action" phpName="DbAction" type="VARCHAR" size="255" required="true" />
    <column name="token" phpName="DbToken" type="VARCHAR" size="40" required="true" />
    <column name="created" phpName="DbCreated" type="TIMESTAMP" required="true" />
    <unique name="cc_subjs_token_idx">
      <unique-column name="token" />
    </unique>
    <foreign-key foreignTable="cc_subjs" name="cc_subjs_token_userid_fkey" onDelete="CASCADE">
      <reference local="user_id" foreign="id" />
    </foreign-key>
  </table>
  <table name="cc_login_attempts" phpName="CcLoginAttempts">
    <column name="ip" phpName="DbIP" primaryKey="true" type="VARCHAR" size="32" required="true" />
    <column name="attempts" phpName="DbAttempts" type="INTEGER" required="false" defaultValue="0" />
  </table>
  <table name="cc_service_register" phpName="CcServiceRegister">
    <column name="name" phpName="DbName" primaryKey="true" type="VARCHAR" size="32" required="true" />
    <column name="ip" phpName="DbIp" type="VARCHAR" size="45" required="true" />
  </table>
  <table name="cc_live_log" phpName="CcLiveLog">
    <column name="id" phpName="DbId" primaryKey="true" type="INTEGER" autoIncrement="true" required="true" />
    <column name="state" phpName="DbState" type="VARCHAR" size="32" required="true" />
    <column name="start_time" phpName="DbStartTime" type="TIMESTAMP" required="true" />
    <column name="end_time" phpName="DbEndTime" type="TIMESTAMP" required="false" />
  </table>
  <table name="cc_webstream" phpName="CcWebstream">
    <column name="id" phpName="DbId" primaryKey="true" type="INTEGER" autoIncrement="true" required="true" />
    <column name="name" phpName="DbName" type="VARCHAR" size="255" required="true" />
    <!-- TODO, remove hardlimit on this column length? -->
    <column name="description" phpName="DbDescription" type="VARCHAR" size="255" required="true" />
    <column name="url" phpName="DbUrl" type="VARCHAR" size="512" required="true" />
    <column name="length" phpName="DbLength" type="VARCHAR" sqlType="interval" required="true" defaultValue="00:00:00" />
    <column name="creator_id" phpName="DbCreatorId" type="INTEGER" required="true" />
    <column name="mtime" phpName="DbMtime" type="TIMESTAMP" size="6" required="true" />
    <column name="utime" phpName="DbUtime" type="TIMESTAMP" size="6" required="true" />
    <column name="lptime" phpName="DbLPtime" type="TIMESTAMP" size="6" required="false" />
    <column name="mime" phpName="DbMime" type="VARCHAR" />
  </table>
  <table name="cc_webstream_metadata" phpName="CcWebstreamMetadata">
    <column name="id" phpName="DbId" primaryKey="true" type="INTEGER" autoIncrement="true" required="true" />
    <column name="instance_id" phpName="DbInstanceId" type="INTEGER" required="true" />
    <column name="start_time" phpName="DbStartTime" type="TIMESTAMP" required="true" />
    <column name="liquidsoap_data" phpName="DbLiquidsoapData" type="VARCHAR" size="1024" required="true" />
    <foreign-key foreignTable="cc_schedule" name="cc_schedule_inst_fkey" onDelete="CASCADE">
      <reference local="instance_id" foreign="id" />
    </foreign-key>
  </table>
  <table name="cc_mount_name" phpName="CcMountName">
    <column name="id" phpName="DbId" primaryKey="true" type="INTEGER" autoIncrement="true" required="true" />
    <column name="mount_name" phpName="DbMountName" type="VARCHAR" required="true" />
  </table>
  <table name="cc_timestamp" phpName="CcTimestamp">
    <column name="id" phpName="DbId" primaryKey="true" type="INTEGER" autoIncrement="true" required="true" />
    <column name="timestamp" phpName="DbTimestamp" type="TIMESTAMP" required="true" />
  </table>
  <table name="cc_listener_count" phpName="CcListenerCount">
    <column name="id" phpName="DbId" primaryKey="true" type="INTEGER" autoIncrement="true" required="true" />
    <column name="timestamp_id" phpName="DbTimestampId" type="INTEGER" required="true" />
    <column name="mount_name_id" phpName="DbMountNameId" type="INTEGER" required="true" />
    <column name="listener_count" phpName="DbListenerCount" type="INTEGER" required="true" />
    <foreign-key foreignTable="cc_timestamp" name="cc_timestamp_inst_fkey" onDelete="CASCADE">
      <reference local="timestamp_id" foreign="id" />
    </foreign-key>
    <foreign-key foreignTable="cc_mount_name" name="cc_mount_name_inst_fkey" onDelete="CASCADE">
      <reference local="mount_name_id" foreign="id" />
    </foreign-key>
  </table>
  <table name="cc_playout_history" phpName="CcPlayoutHistory">
    <column name="id" phpName="DbId" primaryKey="true" type="INTEGER" autoIncrement="true" required="true" />
    <column name="file_id" phpName="DbFileId" type="INTEGER" required="false" />
    <column name="starts" phpName="DbStarts" type="TIMESTAMP" required="true" />
    <column name="ends" phpName="DbEnds" type="TIMESTAMP" required="false" />
    <column name="instance_id" phpName="DbInstanceId" type="INTEGER" required="false" />
    <foreign-key foreignTable="cc_files" name="cc_playout_history_file_tag_fkey" onDelete="CASCADE">
      <reference local="file_id" foreign="id" />
    </foreign-key>
    <foreign-key foreignTable="cc_show_instances" name="cc_his_item_inst_fkey" onDelete="SETNULL">
      <reference local="instance_id" foreign="id" />
    </foreign-key>
  </table>
  <table name="cc_playout_history_metadata" phpName="CcPlayoutHistoryMetaData">
    <column name="id" phpName="DbId" primaryKey="true" type="INTEGER" autoIncrement="true" required="true" />
    <column name="history_id" phpName="DbHistoryId" type="INTEGER" required="true" />
    <column name="key" phpName="DbKey" type="VARCHAR" size="128" required="true" />
    <column name="value" phpName="DbValue" type="VARCHAR" size="128" required="true" />
    <foreign-key foreignTable="cc_playout_history" name="cc_playout_history_metadata_entry_fkey" onDelete="CASCADE">
      <reference local="history_id" foreign="id" />
    </foreign-key>
  </table>
  <table name="cc_playout_history_template" phpName="CcPlayoutHistoryTemplate">
    <column name="id" phpName="DbId" primaryKey="true" type="INTEGER" autoIncrement="true" required="true" />
    <column name="name" phpName="DbName" type="VARCHAR" size="128" required="true" />
    <column name="type" phpName="DbType" type="VARCHAR" size="35" required="true" />
  </table>
  <table name="cc_playout_history_template_field" phpName="CcPlayoutHistoryTemplateField">
    <column name="id" phpName="DbId" primaryKey="true" type="INTEGER" autoIncrement="true" required="true" />
    <column name="template_id" phpName="DbTemplateId" type="INTEGER" required="true" />
    <column name="name" phpName="DbName" type="VARCHAR" size="128" required="true" />
    <column name="label" phpName="DbLabel" type="VARCHAR" size="128" required="true" />
    <column name="type" phpName="DbType" type="VARCHAR" size="128" required="true" />
    <column name="is_file_md" phpName="DbIsFileMD" type="BOOLEAN" required="true" defaultValue="false" />
    <column name="position" phpName="DbPosition" type="INTEGER" required="true" />
    <foreign-key foreignTable="cc_playout_history_template" name="cc_playout_history_template_template_fkey" onDelete="CASCADE">
      <reference local="template_id" foreign="id" />
    </foreign-key>
  </table>
  <table name="third_party_track_references" phpName="ThirdPartyTrackReferences">
    <column name="id" phpName="DbId" primaryKey="true" type="INTEGER" autoIncrement="true" required="true" />
    <column name="service" phpName="DbService" type="VARCHAR" size="256" required="true" />
    <!-- Make foreign ID a VARCHAR field in case a service uses hashes or other non-integer identifiers -->
    <column name="foreign_id" phpName="DbForeignId" type="VARCHAR" size="256" />
    <column name="file_id" phpName="DbFileId" type="INTEGER" default="0" />
    <column name="upload_time" phpName="DbUploadTime" type="TIMESTAMP" />
    <column name="status" phpName="DbStatus" type="VARCHAR" size="256" />
    <unique name="foreign_id_unique">
      <unique-column name="foreign_id" />
    </unique>
    <foreign-key foreignTable="cc_files" name="track_reference_fkey" onDelete="CASCADE">
      <reference local="file_id" foreign="id" />
    </foreign-key>
  </table>

  <table name="celery_tasks" phpName="CeleryTasks">
    <column name="id" phpName="DbId" primaryKey="true" type="INTEGER" autoIncrement="true" required="true" />
    <column name="task_id" phpName="DbTaskId" type="VARCHAR" size="256" required="true" />
    <column name="track_reference" phpName="DbTrackReference" type="INTEGER" required="true" />
    <column name="name" phpName="DbName" type="VARCHAR" size="256" />
    <column name="dispatch_time" phpName="DbDispatchTime" type="TIMESTAMP" />
    <column name="status" phpName="DbStatus" type="VARCHAR" size="256" required="true" />
    <unique name="id_unique">
      <unique-column name="id" />
    </unique>
    <foreign-key foreignTable="third_party_track_references" name="celery_service_fkey" onDelete="CASCADE">
      <reference local="track_reference" foreign="id" />
    </foreign-key>
  </table>

  <table name="podcast" phpName="Podcast">
    <column name="id" phpName="DbId" primaryKey="true" type="INTEGER" autoIncrement="true" required="true" />
    <column name="url" phpName="DbUrl" type="VARCHAR" size="4096" required="true" />
    <column name="title" phpName="DbTitle" type="VARCHAR" size="4096" required="true" />
    <column name="creator" phpName="DbCreator" type="VARCHAR" size="4096" />
    <column name="description" phpName="DbDescription" type="VARCHAR" size="4096" />
    <column name="language" phpName="DbLanguage" type="VARCHAR" size="4096" />
    <column name="copyright" phpName="DbCopyright" type="VARCHAR" size="4096" />
    <column name="link" phpName="DbLink" type="VARCHAR" size="4096" />
    <column name="itunes_author" phpName="DbItunesAuthor" type="VARCHAR" size="4096" />
    <column name="itunes_keywords" phpName="DbItunesKeywords" type="VARCHAR" size="4096" />
    <column name="itunes_summary" phpName="DbItunesSummary" type="VARCHAR" size="4096" />
    <column name="itunes_subtitle" phpName="DbItunesSubtitle" type="VARCHAR" size="4096" />
    <column name="itunes_category" phpName="DbItunesCategory" type="VARCHAR" size="4096" />
    <column name="itunes_explicit" phpName="DbItunesExplicit" type="VARCHAR" size="4096" />
    <column name="owner" phpName="DbOwner" type="INTEGER" />
    <foreign-key foreignTable="cc_subjs" name="podcast_owner_fkey" onDelete="CASCADE">
      <reference local="owner" foreign="id" />
    </foreign-key>
  </table>

  <table name="station_podcast" phpName="StationPodcast">
    <column name="id" phpName="DbId" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
    <column name="podcast_id" phpName="DbPodcastId" required="true" type="INTEGER" />
    <foreign-key foreignTable="podcast" name="podcast_id_fkey" onDelete="CASCADE">
      <reference local="podcast_id" foreign="id" />
    </foreign-key>
    <behavior name="delegate">
      <parameter name="to" value="podcast" />
    </behavior>
  </table>

  <table name="imported_podcast" phpName="ImportedPodcast">
    <column name="id" phpName="DbId" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
    <column name="auto_ingest" phpName="DbAutoIngest" type="BOOLEAN" required="true" defaultValue="false" />
    <column name="auto_ingest_timestamp" phpName="DbAutoIngestTimestamp" type="TIMESTAMP" required="false" />
    <column name="album_override" phpName="DbAlbumOverride" type="BOOLEAN" required="true" defaultValue="false" />
    <column name="podcast_id" phpName="DbPodcastId" required="true" type="INTEGER" />
    <foreign-key foreignTable="podcast" name="podcast_id_fkey" onDelete="CASCADE">
      <reference local="podcast_id" foreign="id" />
    </foreign-key>
    <behavior name="delegate">
      <parameter name="to" value="podcast" />
    </behavior>
  </table>

  <table name="podcast_episodes" phpName="PodcastEpisodes">
    <column name="id" phpName="DbId" primaryKey="true" type="INTEGER" autoIncrement="true" required="true" />
    <column name="file_id" phpName="DbFileId" type="INTEGER" />
    <column name="podcast_id" phpName="DbPodcastId" type="INTEGER" required="true" />
    <column name="publication_date" phpName="DbPublicationDate" type="TIMESTAMP" required="true" />
    <column name="download_url" phpName="DbDownloadUrl" type="varchar" size="4096" required="true" />
    <column name="episode_guid" phpName="DbEpisodeGuid" type="varchar" size="4096" required="true" />
    <column name="episode_title" phpName="DbEpisodeTitle" type="varchar" size="4096" required="true" />
    <column name="episode_description" phpName="DbEpisodeDescription" type="LONGVARCHAR" required="true" />

    <foreign-key foreignTable="cc_files" name="podcast_episodes_cc_files_fkey" onDelete="CASCADE">
      <reference local="file_id" foreign="id" />
    </foreign-key>
    <foreign-key foreignTable="podcast" name="podcast_episodes_podcast_id_fkey" onDelete="CASCADE">
      <reference local="podcast_id" foreign="id" />
    </foreign-key>
  </table>

  <table name="sessions" phpName="Sessions">
    <column name="id" phpName="DbId" primaryKey="true" type="CHAR" size="32" required="true" />
    <column name="modified" phpName="DbModified" type="INTEGER" />
    <column name="lifetime" phpName="DbLifetime" type="INTEGER" />
    <column name="data" phpName="DbData" type="LONGVARCHAR" />
  </table>
</database>
