diff --git a/lib/discovery.js b/lib/discovery.js index c148cc0..27d1497 100644 --- a/lib/discovery.js +++ b/lib/discovery.js @@ -67,7 +67,7 @@ function mixinDiscovery(MySQL, mysql) { 'table_schema, table_name', options); } else if (schema) { sqlTables = paginateSQL('SELECT \'table\' AS "type",' + - ' table_name AS "name", table_schema AS "schema"' + + ' table_name AS "name", table_schema AS "owner"' + ' FROM information_schema.tables' + ' WHERE table_schema=' + mysql.escape(schema), 'table_schema, table_name', options); diff --git a/test/mysql.discover.test.js b/test/mysql.discover.test.js index 6ccf6dd..c12cb19 100644 --- a/test/mysql.discover.test.js +++ b/test/mysql.discover.test.js @@ -69,7 +69,7 @@ describe('discoverModels', function() { var views = false; assert(models.length > 0, 'some models returned'); models.forEach(function(m) { - assert.equal(m.schema.toLowerCase(), config.database.toLowerCase()); + assert.equal(m.owner.toLowerCase(), config.database.toLowerCase()); }); done(null, models); } @@ -112,6 +112,7 @@ describe('Discover models including other users', function() { var others = false; assert.equal(3, models.length); models.forEach(function(m) { + assert(m.owner); if (m.owner !== 'STRONGLOOP') { others = true; }