Created
December 16, 2016 00:17
-
-
Save odirleiborgert/defed51c5790f70668f085a149ebf2ac to your computer and use it in GitHub Desktop.
Dúvidas com o Node.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(sequelize, Sequelize){ | |
var cars = sequelize.define('cars', { | |
brand: Sequelize.STRING, | |
model: Sequelize.STRING, | |
price: Sequelize.STRING, | |
}); | |
return cars; | |
}; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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