Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support collection._schema #238

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Support collection._schema
Fixed error:
> Cannot convert undefined or null to object
  • Loading branch information
SamuelMarks committed Mar 28, 2016
commit 8b1290188b484bf010853b2b1ae51245f47c952d
6 changes: 5 additions & 1 deletion lib/adapter.js
Original file line number Diff line number Diff line change
@@ -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) {