sfGuardGroup:
  actAs: [Timestampable]
  columns:
    id:
      type: integer(4)
      primary: true
      autoincrement: true
    name:
      type: string(255)
      unique: true
    description: string(1000)
  relations:
    users:
      class: sfGuardUser
      refClass: sfGuardUserGroup
      local: group_id
      foreign: user_id
      foreignAlias: Groups
    permissions:
      class: sfGuardPermission
      local: group_id
      foreign: permission_id
      refClass: sfGuardGroupPermission
      foreignAlias: Groups

sfGuardPermission:
  actAs: [Timestampable]
  columns:
    id:
      type: integer(4)
      primary: true
      autoincrement: true
    name:
      type: string(255)
      unique: true
    description: string(1000)

sfGuardGroupPermission:
  options:
    symfony:
      form:   false
      filter: false
  actAs: [Timestampable]
  columns:
    group_id:
      type: integer(4)
      primary: true
    permission_id:
      type: integer(4)
      primary: true
  relations:
    sfGuardGroup:
      local: group_id
      onDelete: CASCADE
    sfGuardPermission:
      local: permission_id
      onDelete: CASCADE

sfGuardUser:
  actAs: [Timestampable]
  columns:
    id:
      type: integer(4)
      primary: true
      autoincrement: true
    username:
      type: string(128)
      notnull: true
      unique: true
    algorithm:
      type: string(128)
      default: sha1
      notnull: true
    salt: string(128)
    password: string(128)
    is_active:
      type: boolean
      default: 1
    is_super_admin:
      type: boolean
      default: false
    last_login:
      type: timestamp
  indexes:
    is_active_idx:
      fields: [is_active]
  relations:
    groups:
      class: sfGuardGroup
      local: user_id
      foreign: group_id
      refClass: sfGuardUserGroup
      foreignAlias: Users
    permissions:
      class: sfGuardPermission
      local: user_id
      foreign: permission_id
      refClass: sfGuardUserPermission
      foreignAlias: Users

sfGuardUserPermission:
  options:
    symfony:
      form:   false
      filter: false
  actAs: [Timestampable]
  columns:
    user_id:
      type: integer(4)
      primary: true
    permission_id:
      type: integer(4)
      primary: true
  relations:
    sfGuardUser:
      local: user_id
      onDelete: CASCADE
    sfGuardPermission:
      local: permission_id
      onDelete: CASCADE

sfGuardUserGroup:
  options:
    symfony:
      form:   false
      filter: false
  actAs: [Timestampable]
  columns:
    user_id:
      type: integer(4)
      primary: true
    group_id:
      type: integer(4)
      primary: true
  relations:
    sfGuardUser:
      local: user_id
      onDelete: CASCADE
    sfGuardGroup:
      local: group_id
      onDelete: CASCADE

sfGuardRememberKey:
  options:
    symfony:
      form:   false
      filter: false
  actAs: [Timestampable]
  columns:
    id:
      type: integer(4)
      primary: true
      autoincrement: true
    user_id:
      type: integer(4)
    remember_key: string(32)
    ip_address:
      type: string(50)
      primary: true
  relations:
    sfGuardUser:
      local: user_id
      foreignAlias: RememberKeys
      foreignType: one
      onDelete: CASCADE