Merge pull request #60 from serkanserttop/fix-inherit-schema-from-datasource
Inherit Schema From DataSource if not defined
This commit is contained in:
commit
de299aed9f
|
@ -177,6 +177,9 @@ function mixinDiscovery(MySQL) {
|
||||||
MySQL.prototype.discoverModelProperties = function (table, options, cb) {
|
MySQL.prototype.discoverModelProperties = function (table, options, cb) {
|
||||||
var args = getArgs(table, options, cb);
|
var args = getArgs(table, options, cb);
|
||||||
var owner = args.owner;
|
var owner = args.owner;
|
||||||
|
if(!owner){
|
||||||
|
owner = inheritOwnerViaDataSource.call(this);
|
||||||
|
}
|
||||||
table = args.table;
|
table = args.table;
|
||||||
options = args.options;
|
options = args.options;
|
||||||
cb = args.cb;
|
cb = args.cb;
|
||||||
|
@ -228,6 +231,9 @@ function mixinDiscovery(MySQL) {
|
||||||
MySQL.prototype.discoverPrimaryKeys = function (table, options, cb) {
|
MySQL.prototype.discoverPrimaryKeys = function (table, options, cb) {
|
||||||
var args = getArgs(table, options, cb);
|
var args = getArgs(table, options, cb);
|
||||||
var owner = args.owner;
|
var owner = args.owner;
|
||||||
|
if(!owner){
|
||||||
|
owner = inheritOwnerViaDataSource.call(this);
|
||||||
|
}
|
||||||
table = args.table;
|
table = args.table;
|
||||||
options = args.options;
|
options = args.options;
|
||||||
cb = args.cb;
|
cb = args.cb;
|
||||||
|
@ -269,6 +275,9 @@ function mixinDiscovery(MySQL) {
|
||||||
MySQL.prototype.discoverForeignKeys = function (table, options, cb) {
|
MySQL.prototype.discoverForeignKeys = function (table, options, cb) {
|
||||||
var args = getArgs(table, options, cb);
|
var args = getArgs(table, options, cb);
|
||||||
var owner = args.owner;
|
var owner = args.owner;
|
||||||
|
if(!owner){
|
||||||
|
owner = inheritOwnerViaDataSource.call(this);
|
||||||
|
}
|
||||||
table = args.table;
|
table = args.table;
|
||||||
options = args.options;
|
options = args.options;
|
||||||
cb = args.cb;
|
cb = args.cb;
|
||||||
|
@ -312,6 +321,9 @@ function mixinDiscovery(MySQL) {
|
||||||
MySQL.prototype.discoverExportedForeignKeys = function (table, options, cb) {
|
MySQL.prototype.discoverExportedForeignKeys = function (table, options, cb) {
|
||||||
var args = getArgs(table, options, cb);
|
var args = getArgs(table, options, cb);
|
||||||
var owner = args.owner;
|
var owner = args.owner;
|
||||||
|
if(!owner){
|
||||||
|
owner = inheritOwnerViaDataSource.call(this);
|
||||||
|
}
|
||||||
table = args.table;
|
table = args.table;
|
||||||
options = args.options;
|
options = args.options;
|
||||||
cb = args.cb;
|
cb = args.cb;
|
||||||
|
@ -366,4 +378,11 @@ function mixinDiscovery(MySQL) {
|
||||||
return 'String';
|
return 'String';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function inheritOwnerViaDataSource(){
|
||||||
|
if(this.dataSource && this.dataSource.settings && this.dataSource.settings.database){
|
||||||
|
return this.dataSource.settings.database;
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue