---
detect_relations: true

AuthMethod:
  tableName: auth_methods
  columns:
    id:
      type: string(32)
      notnull: true
      primary: true
    description: string
    managing_class: string(128)
  actAs:
    Timestampable: true
  relations:
    User:
      refClass: UserAuthMethod
      class: User
      alias: Users
      foreignAlias: AuthMethods

UserAuthMethod:
  tableName: user_auth_methods
  columns:
    user_id: &IDREF
      type: integer
      unsigned: true
      notnull: true
    auth_method_id:
      type: string(32)
      notnull: true
  indexes:
    index_user_authmethod:
      fields: [user_id, auth_method_id]
      primary: true
  relations:
    User:
      foreignAlias: UserAuthMethods
      local: user_id
      class: User
      alias: User
      onUpdate: cascade
      onDelete: cascade
    AuthMethod:
      foreignAlias: UserAuthMethods
      onUpdate: cascade
      onDelete: cascade

