# Version SVN: $Id: schema.yml 355 2018-01-30 09:31:09Z sven.poeche $
propel:
  _attributes:              { package: plugins.stAPIPlugin.lib.model }

  api_auth:
    _attributes:            { phpName: APIAuth, allowPkInsert: true }
    apiid:                  { type: integer, size:  11, required: true, primaryKey: true, autoIncrement: true }
    apikey:                 { type: varchar, size: 255, required: true }
    name:                   { type: varchar, size: 255, required: true }
    lifetime:               { type: integer, size:  11, required: true, default: -1 }
    status:                 { type: integer, size:  11, required: true }
    created_at:             { type: timestamp, required: true }
    _indexes:
      aa_i_username:        [apikey]

  api_token:
    _attributes:            { phpName: APIToken, allowPkInsert: true }
    token:                  { type: varchar, size: 255, required: true, primaryKey: true }
    uid:                    { type: integer, size:  11, required: true, primaryKey: true }
    sessid:                 { type: varchar, size: 128, required: true, primaryKey: true }
    created_at:             { type: timestamp, required: true }
    expired_at:             { type: timestamp, required: false }
    _foreignKeys:
      at_fk_uid:            { foreignTable: user, references: [ {local: uid, foreign: uid} ] }
#     at_fk_sessid:         { foreignTable: session, references: [ {local: sessid, foreign: sessid} ] }
    _indexes:
      at_i_token:           [token]
      at_i_uid:             [uid]
      at_i_sessid:          [sessid]
