Skip to content

Instantly share code, notes, and snippets.

@amandeepmittal
Created December 3, 2018 04:35
Show Gist options
  • Save amandeepmittal/b18c68e95f50e812baed0a62e68747c4 to your computer and use it in GitHub Desktop.
Save amandeepmittal/b18c68e95f50e812baed0a62e68747c4 to your computer and use it in GitHub Desktop.
'use strict';
module.exports = (sequelize, DataTypes) => {
const TodoItem = sequelize.define(
'TodoItem',
{
content: { type: DataTypes.STRING },
complete: { type: DataTypes.BOOLEAN, defaultValue: false }
},
{}
);
TodoItem.associate = function(models) {
// associations can be defined here
TodoItem.belongsTo(models.Todo, {
foreignKey: 'todoId',
onDelete: 'CASCADE'
});
};
return TodoItem;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment