Skip to content

SQL file migrations do not exit on failures #231

@awinder

Description

@awinder

I'd like to get some information on why this is the behavior, or if it's just a bug / oversight. When creating a sql file migration, you end up with code blocks that look like this:

  fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
    if (err) return console.log(err);
      console.log('received data: ' + data);

    db.runSql(data, function(err) {
      if (err) return console.log(err);
      callback();
    });
  });

So in the case of errors you do get a notification, but the process never exits because the callback is skipped over. The easy fix for our team has been to replace return console.log(err); references with return callback(err);, but as a default this doesnt make a lot of sense to me, as it leads to things like hung builds in CI environments. Any chance of changing to return callback(err); for the stubbed-out sql file migrations?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions