Created
August 9, 2017 00:57
-
-
Save taesup/14bea609d30f9864dc8341158e1c60de to your computer and use it in GitHub Desktop.
New syntax for foreign key constraints for sequelize
This file contains 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, DataTypes) { | |
var Task = sequelize.define("Task", { | |
title: DataTypes.STRING | |
}); | |
Task.associate = function(models) { | |
Task.belongsTo(models.User); | |
} | |
return Task; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment