-
-
Save amandeepmittal/77a0cfd353a2e85847d0a64b8c8e2233 to your computer and use it in GitHub Desktop.
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
'use strict'; | |
module.exports = (sequelize, DataTypes) => { | |
const Todo = sequelize.define( | |
'Todo', | |
{ | |
title: { | |
type: DataTypes.STRING | |
} | |
}, | |
{} | |
); | |
Todo.associate = function(models) { | |
// associations can be defined here | |
Todo.hasMany(models.TodoItem, { | |
foreignKey: 'todoId', | |
as: 'todoItems' | |
}); | |
}; | |
return Todo; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment