use "owner" for discovered results

This commit is contained in:
Raymond Feng 2018-07-12 10:42:19 -07:00
parent e714de5b84
commit be599b9347
2 changed files with 3 additions and 2 deletions

View File

@ -67,7 +67,7 @@ function mixinDiscovery(MySQL, mysql) {
'table_schema, table_name', options); 'table_schema, table_name', options);
} else if (schema) { } else if (schema) {
sqlTables = paginateSQL('SELECT \'table\' AS "type",' + 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' + ' FROM information_schema.tables' +
' WHERE table_schema=' + mysql.escape(schema), ' WHERE table_schema=' + mysql.escape(schema),
'table_schema, table_name', options); 'table_schema, table_name', options);

View File

@ -69,7 +69,7 @@ describe('discoverModels', function() {
var views = false; var views = false;
assert(models.length > 0, 'some models returned'); assert(models.length > 0, 'some models returned');
models.forEach(function(m) { models.forEach(function(m) {
assert.equal(m.schema.toLowerCase(), config.database.toLowerCase()); assert.equal(m.owner.toLowerCase(), config.database.toLowerCase());
}); });
done(null, models); done(null, models);
} }
@ -112,6 +112,7 @@ describe('Discover models including other users', function() {
var others = false; var others = false;
assert.equal(3, models.length); assert.equal(3, models.length);
models.forEach(function(m) { models.forEach(function(m) {
assert(m.owner);
if (m.owner !== 'STRONGLOOP') { if (m.owner !== 'STRONGLOOP') {
others = true; others = true;
} }