title: How to create a TRIGGER in SEQUELIZE (nodeJS)?
body: <p>I'm trying to create a trigger using sequelize.. the main idea is to create an instance of <code>CONFIG</code> after creating a <code>USER</code>.</p>
  
  <pre><code>// USER MODEL
  module.exports = function(sequelize, DataTypes) {    
      var User = sequelize.define('User', {
          name        : DataTypes.STRING(255),
          email       : DataTypes.STRING(255),
          username    : DataTypes.STRING(45),
          password    : DataTypes.STRING(100),
      }, {
          classMethods : {
              associate : function(models) {
                  User.hasOne(models.Config)
              }
          }
      });    
      return User;
  };
  
  // CONFIG MODEL
  module.exports = function(sequelize, DataTypes) {
      var Config = sequelize.define('Config', {
          notifications   : DataTypes.INTEGER
      }, {
          classMethods : {
              associate : function(models) {
                  Config.belongsTo(models.User)
              }
          }
      });
  
      return Config;
  };
  </code></pre>
  
  <p>As you can see, a "user" has one "config" and a "config" belongs to a "user", so after a user is created I want to create his config row automatically.</p>
  
  <p>The goal is to do:</p>
  
  <pre><code>DELIMITER //
  CREATE TRIGGER create_config AFTER INSERT ON user
    FOR EACH ROW
  BEGIN
      insert into config    (user_id)     values(new.user_id);
  END; //
  DELIMITER ;
  </code></pre>
  
  <p>Now, what I do to simulate that is the following:</p>
  
  <pre><code>.then(function(user){
     return dao.Config.create(req.body, user, t);
  })
  </code></pre>
  
  <p>Once a User is created I create his configuration like that... it works but is not what I'm searching.</p>
  
  <p>How would I do it?</p>