Skip to content

Instantly share code, notes, and snippets.

@wharley
Created March 3, 2017 20:28
Show Gist options
  • Save wharley/b42caa37566086a8b71685dae4320f4a to your computer and use it in GitHub Desktop.
Save wharley/b42caa37566086a8b71685dae4320f4a to your computer and use it in GitHub Desktop.
module.exports = function(sequelize, DataTypes){
var Rece = sequelize.define('Receita', {
id: {
type : DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
field: 'seq_receita'
},
cod_pessoa: {
type : DataTypes.INTEGER,
field: 'cod_pessoa'
},
nome_receita: {
type : DataTypes.STRING,
field: 'nome_receita'
},
seq_tipo_receita: {
type : DataTypes.STRING,
field: 'seq_tipo_receita'
},
data_vencimento: {
type: DataTypes.DATE,
allowNull: true,
field: 'data_vencimento'
}
},
{
freezeTableName: true,
schema: 'public',
tableName: 'receita',
timestamps: false,
classMethods: {
associate: function(model) {
Rece.belongsTo(model.Pessoa, {foreignKey: 'cod_pessoa'});
}
}
});
return Rece;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment