<commit_before>module.exports = function (sequelize, DataTypes) {
  const attributes = {
    name: DataTypes.STRING,
    description: DataTypes.TEXT,
  };

  var Course = sequelize.define('Course', attributes);

  return Course;
};<commit_msg>add slug name hook on course model<commit_after>const slug = require('slug');

module.exports = function (sequelize, DataTypes) {
  const attributes = {
    name: DataTypes.STRING,
    slug: DataTypes.STRING,
    description: DataTypes.TEXT,
  };

  const Course = sequelize.define('Course', attributes);

  const slugNameHook = function (course) {
    course.slug = slug(course.name, { lower: true });
  };

  Course.beforeCreate(slugNameHook);
  Course.beforeUpdate(slugNameHook);

  return Course;
};
{'fraction_non_alphanumeric': 0.12466487935656836, 'fraction_numerical': 0.0, 'mean_word_length': 4.297872340425532, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3920957', 'n_tokens_mistral': 234, 'n_tokens_neox': 223, 'n_words': 53}