# Version SVN: $Id: 55_forums_schema.yml 1695 2013-06-06 15:54:32Z sven.poeche $
propel:
  forum:
    _attributes:            { phpName: Forum, allowPkInsert: true }
    forumid:                { type: integer, size:  11, required: true, primaryKey: true, autoIncrement: true }
    forumtype:              { type: integer, size:  11, required: true, default: 0 } # 0=general, 1=group
    forumkey:               { type: varchar, size:  32, required: true }
    status:                 { type: integer, size:  11, required: true, default: 0 } # 0=created, 1=verify, 2=illegal, 3=legal, 4=deleted
    sid:                    { type: integer, size:  11, required: true }
    count_threads:          { type: integer, size:  11, required: true, default: 0 }
    count_thread_users:     { type: integer, size:  11, required: true, default: 0 }
    last_thread:            { type: timestamp }
    count_comments:         { type: integer, size:  11, required: true, default: 0 }
    count_comment_users:    { type: integer, size:  11, required: true, default: 0 }
    last_comment:           { type: timestamp }
    created_at:             { type: timestamp, required: true }
    updated_at:             { type: timestamp, required: true }
    _foreignKeys:
      forum_fk_sid:         { foreignTable: statictext, references: [ {local: sid, foreign: sid} ] }
    _indexes:
      forum_i_forumkey:     [forumkey]
      forum_i_forumtype:    [forumtype]
      forum_i_sid:          [sid]


  forum_thread:
    _attributes:            { phpName: ForumThread, allowPkInsert: true }
    threadid:               { type: integer, size:  11, required: true, primaryKey: true, autoIncrement: true }
    forumid:                { type: integer, size:  11, required: true }
    uid:                    { type: integer, size:  11, required: true }
    sid:                    { type: integer, size:  11, required: true }
    status:                 { type: integer, size:  11, required: true, default: 0 } # 0=created, 1=verify, 2=illegal, 3=legal, 4=deleted
    count_comments:         { type: integer, size:  11, required: true, default: 0 }
    count_comment_users:    { type: integer, size:  11, required: true, default: 0 }
    last_comment:           { type: timestamp }
    created_at:             { type: timestamp, required: true }
    updated_at:             { type: timestamp, required: true }
    _foreignKeys:
      ft_fk_forumid:        { foreignTable: forum, references: [ {local: forumid, foreign: forumid} ] }
      ft_fk_uid:            { foreignTable: user, references: [ {local: uid, foreign: uid} ] }
      ft_fk_sid:            { foreignTable: statictext, references: [ {local: sid, foreign: sid} ] }
    _indexes:
      ft_i_uid:             [uid]
      ft_i_sid:             [sid]


  forum_comment:
    _attributes:            { phpName: ForumComment, allowPkInsert: true }
    commentid:              { type: integer, size:  11, required: true, primaryKey: true, autoIncrement: true }
    threadid:               { type: integer, size:  11, required: true }
    sid:                    { type: integer, size:  11, required: true }
    uid:                    { type: integer, size:  11, required: true }
    pid:                    { type: integer, size:  11, required: true, default: 0 }
    ano_username:           { type: varchar, size: 255 }
    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:
      fc_fk_threadid:       { foreignTable: forum_thread, references: [ {local: threadid, foreign: threadid} ] }
      fc_fk_sid:            { foreignTable: statictext, references: [ {local: sid, foreign: sid} ] }
      fc_fk_uid:            { foreignTable: user, references: [ {local: uid, foreign: uid} ] }
    _indexes:
      fc_i_threadid:        [threadid]
      fc_i_sid:             [sid]
      fc_i_uid:             [uid]
      fc_i_pid:             [pid]


  forum_view:
    _attributes:            { phpName: ForumView, allowPkInsert: true }
    fvid:                   { type: integer, size:  11, required: true, primaryKey: true, autoIncrement: true }
    threadid:               { 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:
      fv_fk_threadid:      { foreignTable: forum_thread, references: [ {local: threadid, foreign: threadid} ] }
      fv_fk_uid:           { foreignTable: user, references: [ {local: uid, foreign: uid} ] }
    _indexes:
      fv_i_threadid:       [threadid]
      fv_i_uid:            [uid]

