# Version SVN: $Id: schema.yml 131 2015-07-28 10:19:49Z sven.poeche $
propel:
  _attributes:              { package: plugins.stLiveStreamingPlugin.lib.model }

  livestream:
    _attributes:                    { phpName: LiveStream, allowPkInsert: true, isI18N: true, i18nTable: livestream_i18n }
    lsid:                           { type: integer, size:  11, required: true, primaryKey: true, autoIncrement: true }
    streamtype:                     { type: integer, size:  11, required: true, default: 0 } # 0 = video, 1 = audio
    hidden:                         { type: boolean, size:   1, required: true, default: false } # livestream is private, only livestream users can see it
    verify:                         { type: boolean, size:   1, required: true, default: false } # livestream users must verify by livestream administrator
    status:                         { type: integer, size:  11, required: true, default: 0 } # 0=created, 1=verify, 2=illegal, 3=legal, 4=deleted
    uid:                            { type: integer, size: 11, required: true }
    picture_filename:               { type: varchar, size: 255 }
    picture_menu_filename:          { type: varchar, size: 255 }
    picture_cover_filename:         { type: varchar, size: 255 }
    picture_placeholder_filename:   { type: varchar, size: 255 }
    font_color_title:               { type: varchar, size: 16, default '#000000' }
    font_color_content:             { type: varchar, size: 16, default '#000000' }
    stream_rtmp:                    { type: varchar, size: 255 }
    stream_hls:                     { type: varchar, size: 255 }
    stream_rtp:                     { type: varchar, size: 255 }
    stream_hds:                     { type: varchar, size: 255 }
    stream_silverlight:             { type: varchar, size: 255 }
    stream_mp3:                     { type: varchar, size: 255 }
    stream_aac:                     { type: varchar, size: 255 }
    weight:                         { type: integer, size:  11, required: true, default: 0 }
    sum_rating:                     { type: float,   size:   8, scale: 2, required: true, default: 0.00 } # sums up livestream_rating table
    sum_likes:                      { type: integer, size:  11, required: true, default: 0 } # sums up livestream_like table
    count_views:                    { type: integer, size:  11, required: true, default: 0 }
    count_users:                    { type: integer, size:  11, required: true, default: 0 }
    count_rating:                   { type: integer, size:  11, required: true, default: 0 } # sums up livestream_rating table
    count_likes:                    { type: integer, size:  11, required: true, default: 0 } # sums up livestream_like table
    count_favorites:                { type: integer, size:  11, required: true, default: 0 } # sums up all user favorites by using livestream_favorite table
    count_comments:                 { type: integer, size:  11, required: true, default: 0 } # sums up livestream_comment table
    count_flags:                    { type: integer, size:  11, required: true, default: 0 } # sums up livestream_flag table
    created_at:                     { type: timestamp, required: true }
    updated_at:                     { type: timestamp, required: true }
    _foreignKeys:
      ls_fk_uid:                    { foreignTable: user, references: [ {local: uid, foreign: uid} ] }
    _indexes:
      ls_i_uid:                     [uid]
      ls_i_created_at:              [created_at]
      ls_i_status:                  [status]
      ls_i_status_created:          [status, created_at]


  livestream_i18n:
    _attributes:            { phpName: LiveStreamI18n, allowPkInsert: true }
    lsid:                   { type: integer, size:  11, required: true, primaryKey: true }
    culture:                { type: varchar, size:   7, required: true, primaryKey: true, isCulture: true }
    name:                   { type: varchar, size: 255, required: true }
    description:            { type: longvarchar }
    _foreignKeys:
      lsi_fk_lsid:          { foreignTable: livestream, references: [ {local: lsid, foreign: lsid} ] }
    _indexes:
      lsi_i_lsid:           [lsid]
      lsi_i_culture:        [culture]


  livestream_user:
    _attributes:            { phpName: LiveStreamUser, allowPkInsert: true }
    lsid:                   { type: integer, size: 11, required: true, primaryKey: true }
    uid:                    { type: integer, size: 11, required: true, primaryKey: true }
    status:                 { type: integer, size:  11, required: true, default: 0 } # 0=created, 1=verify, 2=illegal, 3=legal, 4=deleted
    created_at:             { type: timestamp, required: true }
    updated_at:             { type: timestamp, required: true }
    _foreignKeys:
      lsu_fk_lsid:          { foreignTable: livestream, references: [ {local: lsid, foreign: lsid} ] }
      lsu_fk_uid:           { foreignTable: user, references: [ {local: uid, foreign: uid} ] }
    _indexes:
      lsu_i_lsid:           [lsid]
      lsu_i_uid:            [uid]


  livestream_category:
    _attributes:            { phpName: LiveStreamCategory, allowPkInsert: true }
    lsid:                   { type: integer, size:  11, required: true, primaryKey: true }
    cid:                    { type: integer, size:  11, required: true, primaryKey: true }
    _foreignKeys:
      lsc_fk_lsid:          { foreignTable: livestream, references: [ {local: lsid, foreign: lsid} ] }
      lsc_fk_cid:           { foreignTable: category, references: [ {local: cid, foreign: cid} ] }
    _indexes:
      lsc_i_lsid:           [lsid]
      lsc_i_cid:            [cid]


  livestream_view:
    _attributes:            { phpName: LiveStreamView, allowPkInsert: true }
    lsvid:                  { type: integer, size:  11, required: true, primaryKey: true, autoIncrement: true }
    lsid:                   { type: integer, size:  11, required: true }
    uid:                    { type: integer, size:  11, required: true }
    sessid:                 { type: varchar, size: 128, required: true }
    hostname:               { type: varchar, size: 244, required: true }
    external:               { type: boolean, size:   1, required: true, default: false }
    external_url:           { type: varchar, size: 1024 }
    created_at:             { type: timestamp, required: true }
    _foreignKeys:
      lsv_fk_lsid:          { foreignTable: livestream, references: [ {local: lsid, foreign: lsid} ] }
      lsv_fk_uid:           { foreignTable: user, references: [ {local: uid, foreign: uid} ] }
    _indexes:
      lsv_i_lsid:           [lsid]
      lsv_i_uid:            [uid]


  livestream_tag:
    _attributes:                { phpName: LiveStreamTag, allowPkInsert: true }
    lsid:                       { type: integer, size:  11, required: true, primaryKey: true }
    tid:                        { type: integer, size:  11, required: true, primaryKey: true }
    pos:                        { type: integer, size:   3, required: true }
    _foreignKeys:
      lst_fk_lsid:              { foreignTable: livestream, references: [ {local: lsid, foreign: lsid} ] }
      lst_fk_tid:               { foreignTable: tag, references: [ {local: tid, foreign: tid} ] }
    _indexes:
      lst_i_lsid:               [lsid]
      lst_i_tid:                [tid]


  livestream_rating:
    _attributes:                { phpName: LiveStreamRating, allowPkInsert: true }
    lsid:                       { type: integer, size:  11, required: true, primaryKey: true }
    uid:                        { type: integer, size:  11, required: true, primaryKey: true }
    hostname:                   { type: varchar, size: 255, required: ture, primaryKey: true }
    rating:                     { type: integer, size:   3, required: true }
    created_at:                 { type: timestamp, required: true, primaryKey: true }
    updated_at:                 { type: timestamp, required: true }
    _foreignKeys:
      lsr_fk_lsid:              { foreignTable: livestream, references: [ {local: lsid, foreign: lsid} ] }
      lsr_fk_uid:               { foreignTable: user, references: [ {local: uid, foreign: uid} ] }
    _indexes:
      lsr_i_lsid:               [lsid]
      lsr_i_uid:                [uid]


  livestream_like:
    _attributes:                { phpName: LiveStreamLike, allowPkInsert: true }
    lsid:                       { type: integer, size:  11, required: true, primaryKey: true }
    uid:                        { type: integer, size:  11, required: true, primaryKey: true }
    hostname:                   { type: varchar, size: 255, required: ture, primaryKey: true }
    like:                       { type: integer, size:   3, required: true }
    created_at:                 { type: timestamp, required: true, primaryKey: true }
    updated_at:                 { type: timestamp, required: true }
    _foreignKeys:
      lsl_fk_lsid:              { foreignTable: livestream, references: [ {local: lsid, foreign: lsid} ] }
      lsl_fk_uid:               { foreignTable: user, references: [ {local: uid, foreign: uid} ] }
    _indexes:
      lsl_i_lsid:               [lsid]
      lsl_i_uid:                [uid]


  livestream_comment:
    _attributes:                { phpName: LiveStreamComment, allowPkInsert: true }
    lscid:                      { type: integer, size:  11, required: true, primaryKey: true, autoIncrement: true }
    lsid:                       { type: integer, size:  11, required: true }
    pid:                        { type: integer, size:  11, required: true, default: 0 }
    uid:                        { type: integer, size:  11, required: true }
    ano_username:               { type: varchar, size: 255 }
    text:                       { type: longvarchar, required: true }
    status:                     { type: integer, size:  11, required: true, default: 0 } # 0=created, 1=verify, 2=illegal, 3=legal, 4=deleted
    created_at:                 { type: timestamp, required: true }
    updated_at:                 { type: timestamp, required: true }
    _foreignKeys:
      lsco_fk_lsid:             { foreignTable: livestream, references: [ {local: lsid, foreign: lsid} ] }
      lsco_fk_uid:              { foreignTable: user, references: [ {local: uid, foreign: uid} ] }
    _indexes:
      lsco_i_lsid:              [lsid]
      lsco_i_pid:               [pid]
      lsco_i_uid:               [uid]


  livestream_flag:
    _attributes:                { phpName: LiveStreamFlag, allowPkInsert: true }
    flagid:                     { type: integer, size: 11, required: true, primaryKey: true, autoIncrement: true }
    lsid:                       { type: integer, size: 11, required: true }
    uid:                        { type: integer, size: 11, required: true }
    reason:                     { type: longvarchar, required: true }
    status:                     { type: integer, size:  11, required: true, default: 0 } # 0=flagged, 1=confirmed, 2=rejected
    created_at:                 { type: timestamp, required: true }
    updated_at:                 { type: timestamp, required: true }
    _foreignKeys:
      lsf_fk_lsid:              { foreignTable: livestream, references: [ {local: lsid, foreign: lsid} ] }
      lsf_fk_uid:               { foreignTable: user, references: [ {local: uid, foreign: uid} ] }
    _indexes:
      lsf_i_lsid:               [lsid]
      lsf_i_uid:                [uid]
      lsf_i_status:             [status]


  livestream_favorite:
    _attributes:            { phpName: LiveStreamFavorite, allowPkInsert: true }
    uid:                    { type: integer, size:  11, required: true, primaryKey: true }
    lsid:                   { type: integer, size:  11, required: true, primaryKey: true }
    created_at:             { type: timestamp, required: true }
    updated_at:             { type: timestamp, required: true }
    _foreignKeys:
      lsfav_fk_uid:         { foreignTable: user, references: [ {local: uid, foreign: uid} ] }
      lsfav_fk_lsid:        { foreignTable: livestream, references: [ {local: lsid, foreign: lsid} ] }
    _indexes:
      lsfav_i_uid_lsid:     [uid, lsid]
      lsfav_i_uid:          [uid]
      lsfav_i_lsid:         [lsid]

