/**
   * Created by Bruno Costa 28-04-2018
   * Generated by Utilities/createTable.py
   */
  'use strict';

  module.exports = function(sequelize, DataTypes) {
    const OntologyReference = sequelize.define('OntologyReference', {
      id: { 
        type: DataTypes.INTEGER(11),
        autoIncrement: true,
        primaryKey: true,
        allowNull: false,
        unique: true,
      },
    ontologyId: DataTypes.INTEGER(11),
    type: DataTypes.STRING(254),
    url: DataTypes.STRING(254),
  }, {
      tableName: 'OntologyReference',
      timestamps: false,
      underscored: false,

     classMethods: {
        associate: function associate(models) {    
          OntologyReference.belongsTo(models.Ontology, {
            foreignKey: 'ontologyId',              //on OntologyReference
            targetKey: 'id',  //foreign key  
          }); 
        }
      },
    });

    return OntologyReference;
  };