aboutsummaryrefslogblamecommitdiffhomepage
path: root/server/models/author.js
blob: 493c2ca112efecb9fd7548da0d5e83ed583b8f41 (plain) (tree)



























                                                                              
module.exports = function (sequelize, DataTypes) {
  const Author = sequelize.define('Author',
    {
      name: {
        type: DataTypes.STRING
      }
    },
    {
      classMethods: {
        associate
      }
    }
  )

  return Author
}

// ---------------------------------------------------------------------------

function associate (models) {
  this.belongsTo(models.Pod, {
    foreignKey: {
      name: 'podId',
      allowNull: true
    },
    onDelete: 'cascade'
  })
}