title: node-orm sync to Alter Tables (similar to DataMapper.auto_upgrade)
body: <p>I'm using node-orm to try to setup my database. Here is the model code.</p>
  
  <pre><code>db = orm.connect("mysql", client, (success, db) -&gt;
    Strain = db.define("strain",
      name:
        type: "string"
        validations: [ orm.validators.unique() ]
      old_body:
        type: "string"
      body:
        type: "string"
      created_at:
        type: "date"
      update_at:
        type: "date"
    )
    Strain.sync()
  ) 
  </code></pre>
  
  <p>I changed the /orm/lib/databases/mysql.js file to console.log the returned Sync info.</p>
  
  <pre><code>this._client.query(_query, function (err, info) {
    console.log(err);
    console.log(info);
    console.log("collection synced");
  });
  </code></pre>
  
  <p>The first time Strain.sync() runs, this is the output.</p>
  
  <pre><code>null
  
  { affectedRows: 0,
    insertId: 0,
    serverStatus: 2,
    warningCount: 0,
    message: '',
    setMaxListeners: [Function],
    emit: [Function],
    addListener: [Function],
    on: [Function],
    once: [Function],
    removeListener: [Function],
    removeAllListeners: [Function],
    listeners: [Function] }
  
  collection synced
  </code></pre>
  
  <p>Now the table is created as it should be. When I restart the server and run Strain.sync() again, this is the output:</p>
  
  <pre><code>null
  
  { affectedRows: 0,
    insertId: 0,
    serverStatus: 2,
    warningCount: 1,
    message: '',
    setMaxListeners: [Function],
    emit: [Function],
    addListener: [Function],
    on: [Function],
    once: [Function],
    removeListener: [Function],
    removeAllListeners: [Function],
    listeners: [Function] }
  
  collection synced
  </code></pre>
  
  <p>The warning count jumped to "1", but err is null, and message is empty.</p>
  
  <p>I need to figure out how I can change the model and add a new property, like "deleted_at", and update the table WITHOUT losing data. I know I can do Strain.sync( force: true ), but that will drop the table then re-create it. I'm just looking to update the table, similar to DataMapper's auto_upgrade function.</p>
  
  <p>Is there any way to do this with node-orm, or any ORM that works with nodejs?</p>