From 8b1290188b484bf010853b2b1ae51245f47c952d Mon Sep 17 00:00:00 2001 From: Samuel Marks Date: Mon, 28 Mar 2016 17:26:10 +1100 Subject: [PATCH] Support collection._schema Fixed error: > Cannot convert undefined or null to object --- lib/adapter.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/adapter.js b/lib/adapter.js index f9b31e6..932362c 100644 --- a/lib/adapter.js +++ b/lib/adapter.js @@ -78,6 +78,7 @@ module.exports = (function() { _.each(_.keys(collections), function(collName) { var collection = collections[collName]; + collection.schema = collection.schema || collection._schema; if(!collection) { return; } @@ -1160,6 +1161,7 @@ module.exports = (function() { var connectionObject = connections[connectionName]; var collection = connectionObject.collections[table]; + collection.schema = collection.schema || collection._schema; var client = new pg.Client(connectionObject.config); client.connect(); @@ -1523,7 +1525,9 @@ module.exports = (function() { } function getCollection(connectionName, table) { - return connections[connectionName].collections[table]; + var collection = connections[connectionName].collections[table]; + collection.schema = collection.schema || collection._schema; + return collection; } function getSchema(collectionOrConnectionName, table) {