title: Sequelize: Changing model schema on production
body: <p>We're using the orm <a href="http://sequelizejs.com" rel="noreferrer">sequelize.js</a> and have defined a model as such:</p>
  
  <pre><code>module.exports = function(sequelize, DataTypes) {
      var Source = sequelize.define('Source', {
          name: {
              type: DataTypes.STRING, 
              allowNull: false, 
              unique: true
          }
      }, {
          paranoid: true
      });
  
      return Source;
  };
  </code></pre>
  
  <p>This is deployed to production and sync'd to the database using <code>sequelize.sync</code>. Next step, we add a parameter:</p>
  
  <pre><code>module.exports = function(sequelize, DataTypes) {
      var Source = sequelize.define('Source', {
          name: {
              type: DataTypes.STRING, 
              allowNull: false, 
              unique: true
          }, 
              location: {
                      type: DataTypes.STRING
              }
      }, {
          paranoid: true
      });
  
      return Source;
  };
  </code></pre>
  
  <p>However, when deploying to production <code>sequelize.sync</code> does not add this new parameter. This is because <code>sync</code> does a:</p>
  
  <p><code>CREATE TABLE IF NOT EXISTS</code></p>
  
  <p>And does not actually update the schema if the table exists. This is <a href="http://sequelizejs.com/docs/latest/models#database-synchronization" rel="noreferrer">noted in their documentation</a>.</p>
  
  <p>The only option seems to be to <code>{ force: true }</code>, however this is not okay for a production database.</p>
  
  <p>Does anyone know how to properly update the schema when changes are necessary?</p>