Skip to content

Instantly share code, notes, and snippets.

@taesup
Created August 9, 2017 00:57
Show Gist options
  • Save taesup/14bea609d30f9864dc8341158e1c60de to your computer and use it in GitHub Desktop.
Save taesup/14bea609d30f9864dc8341158e1c60de to your computer and use it in GitHub Desktop.
New syntax for foreign key constraints for sequelize
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