Skip to content

Instantly share code, notes, and snippets.

@amandeepmittal
Created December 3, 2018 04:35
Show Gist options
  • Save amandeepmittal/77a0cfd353a2e85847d0a64b8c8e2233 to your computer and use it in GitHub Desktop.
Save amandeepmittal/77a0cfd353a2e85847d0a64b8c8e2233 to your computer and use it in GitHub Desktop.
'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