Skip to content

Instantly share code, notes, and snippets.

@odirleiborgert
Created December 16, 2016 00:17
Show Gist options
  • Save odirleiborgert/defed51c5790f70668f085a149ebf2ac to your computer and use it in GitHub Desktop.
Save odirleiborgert/defed51c5790f70668f085a149ebf2ac to your computer and use it in GitHub Desktop.
Dúvidas com o Node.js
module.exports = function(sequelize, Sequelize){
var cars = sequelize.define('cars', {
brand: Sequelize.STRING,
model: Sequelize.STRING,
price: Sequelize.STRING,
});
return cars;
};
{
"id":1,
"brand":"Peugeot",
"model":"206 Sw Presence 1.4/ 1.4 Flex 8v 5p",
"price":17500,
"createdAt":"2014-05-16T21:57:18.000Z",
"updatedAt":"2016-08-31T03:15:20.000Z",
"userId":491
}
module.exports = function(sequelize, Sequelize){
var users = sequelize.define('users', {
name: Sequelize.STRING
},{
classMethods: {
associate: function(models){
users.hasMany(models.cars);
}
}
});
return users;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment