# Version SVN: $Id: 25_groups_schema.yml 5237 2017-05-17 11:51:29Z zoran.zatezalo $
propel:
  groups:
    _attributes:            { phpName: Group, allowPkInsert: true }
    gid:                    { type: integer, size:  11, required: true, primaryKey: true, autoIncrement: true }
    uid:                    { type: integer, size:  11, required: true }
    groupkey:               { type: varchar, size:  32, required: true }
    hidden:                 { type: boolean, size:   1, required: true,  default: false }
    visibility_in_overview: { type: boolean, size:   1, required: false, default: true }
    verify:                 { type: boolean, size:   1, required: true,  default: false } # group members must verify
    status:                 { type: integer, size:  11, required: true,  default: 0 } # 0=created, 1=verify, 2=illegal, 3=legal, 4=deleted
    featured:               { type: boolean, size:   1, required: true,  default: false }
    culture:                { type: varchar, size:   7, required: true }
    title:                  { type: varchar, size: 255, required: true }
    description:            { type: longvarchar }
    picture_filename:       { type: varchar, size: 255 } # filename of the group picture
    cover_filename:         { type: varchar, size: 255 } # filename of the group cover picture
    notify_member:          { type: boolean, size:   1, required: true,  default: false }
    weight:                 { type: integer, size:  11, required: true, default: 0 }
    last_access_at:         { type: timestamp }
    count_members:          { type: integer, size:  11, required: true, default: 0 }
    count_media:            { type: integer, size:  11, required: true, default: 0 }
    count_media_videos:     { type: integer, size:  11, required: true, default: 0 }
    count_media_photos:     { type: integer, size:  11, required: true, default: 0 }
    count_media_audios:     { type: integer, size:  11, required: true, default: 0 }
    count_media_documents:  { type: integer, size:  11, required: true, default: 0 }
    created_at:             { type: timestamp, required: true }
    updated_at:             { type: timestamp, required: true }
    _foreignKeys:
      g_fk_uid:             { foreignTable: user, references: [ {local: uid, foreign: uid} ] }
    _indexes:
      g_i_uid:              [uid]
      g_i_culture:          [culture]


  groups_member:
    _attributes:            { phpName: GroupMember, allowPkInsert: true }
    gid:                    { 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=join, 1=invited, 2=illegal, 3=legal, 4=deleted
    created_at:             { type: timestamp, required: true }
    updated_at:             { type: timestamp, required: true }
    _foreignKeys:
      gm_fk_gid:            { foreignTable: groups, references: [ {local: gid, foreign: gid} ] }
      gm_fk_uid:            { foreignTable: user, references: [ {local: uid, foreign: uid} ] }
    _indexes:
      gm_i_gid:             [gid]
      gm_i_uid:             [uid]


  groups_media:
    _attributes:            { phpName: GroupMedia, allowPkInsert: true }
    gid:                    { type: integer, size:  11, required: true, primaryKey: true }
    mid:                    { type: integer, size:  11, required: true, primaryKey: true }
    created_at:             { type: timestamp, required: true }
    updated_at:             { type: timestamp, required: true }
    _foreignKeys:
      gme_fk_gid:           { foreignTable: groups, references: [ {local: gid, foreign: gid} ] }
      gme_fk_mid:           { foreignTable: media, references: [ {local: mid, foreign: mid} ] }
    _indexes:
      gme_i_gid:            [gid]
      gme_i_mid:            [mid]


  groups_forum:
    _attributes:            { phpName: GroupForum, allowPkInsert: true }
    gid:                    { type: integer, size:  11, required: true, primaryKey: true }
    forumid:                { type: integer, size:  11, required: true, primaryKey: true }
    created_at:             { type: timestamp, required: true }
    updated_at:             { type: timestamp, required: true }
    _foreignKeys:
      gf_fk_gid:            { foreignTable: groups, references: [ {local: gid, foreign: gid} ] }
      gf_fk_forumid:        { foreignTable: forum, references: [ {local: forumid, foreign: forumid} ] }
    _indexes:
      gf_i_gid:             [gid]
      gf_i_forumid:         [forumid]


  groups_view:
    _attributes:            { phpName: GroupView, allowPkInsert: true }
    gvid:                   { type: integer, size:  11, required: true, primaryKey: true, autoIncrement: true }
    gid:                    { 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:
      gv_fk_gid:            { foreignTable: groups, references: [ {local: gid, foreign: gid} ] }
      gv_fk_uid:            { foreignTable: user, references: [ {local: uid, foreign: uid} ] }
    _indexes:
      gv_i_gid:             [gid]
      gv_i_uid:             [uid]
