When table data has been collected, build an object representation of them
function onTableDataCollected(err, data) {
    bailOnError(err);

    var tableName, models = {}, model;
    for (tableName in data.tableStructure) {
        model = steps.tableToObject({
            name: tableName,
            columns: data.tableStructure[tableName],
            comment: data.tableComments[tableName]
        }, opts);

        models[model.name] = model;
    }

    data.models = steps.findReferences(models);

    // Note: This mutates the models - sorry. PRs are welcome.
    steps.findOneToManyReferences(adapter, data.models, function(refErr) {
        if (refErr) {
            throw refErr;
        }

        data.types = steps.generateTypes(data, opts);

        adapter.close();
        steps.outputData(data, opts, onDataOutput);
    });
}