Second allen's request with small modification: yoni, if you haven't
already, mind trying the actual migration? Can't do fresh install on
production, exactly, because we need to save the existing data (and don't
want to spend time writing a conversion script if we already have migration
info).


On Tue, May 27, 2014 at 12:05 PM, Yonatan Kogan <notifications@github.com>wrote:

> In migrations/20140526155137-create_tables.js:
>
> > +        fs.readFile(__dirname + '/initial.sql', function(err, data){
> > +          if (err) throw err;
> > +          cb(null, data.toString());
> > +        });
> > +      },
> > +
> > +      function(initialSchema, cb){
> > +        // need to split on ';' to get the individual CREATE TABLE sql
> > +        // as db.query can execute on query at a time
> > +        var tables = initialSchema.split(';');
> > +
> > +        function createTable(tableSql, doneCreate){
> > +          db.query(tableSql).complete(doneCreate);
> > +        }
> > +
> > +        async.each(tables, createTable, cb);
>
> I'm kinda surprised this works. cb will move forward the waterfall when
> it's called once and we're calling it once for each .each.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/thelac/boxplot/pull/62/files#r13085855>
> .
>