{"action":"created","comment":{"url":"https://api.github.com/repos/senecajs/seneca-postgres-store/pulls/comments/58990185","id":58990185,"diff_hunk":"@@ -448,3 +449,108 @@ describe('postgres store API V2.0.0', function () {\n     })\n   })\n })\n+\n+var siDefault = Seneca({\n+  default_plugins: {\n+    'mem-store': false\n+  }\n+})\n+\n+var siCustom = Seneca({\n+  default_plugins: {\n+    'mem-store': false\n+  }\n+})\n+\n+describe('Column Names conversions', function () {\n+  describe('Default CamelCase to snake_case conversion', function () {\n+    before({}, function (done) {\n+      siDefault.use(require('..'), DefaultConfig)\n+      siDefault.ready(function () {\n+        siDefault.use(require('seneca-store-query'))\n+        siDefault.ready(done)\n+      })\n+    })\n+\n+    beforeEach(clearDb(siDefault))\n+    beforeEach(createEntities(siDefault, 'foo', [{\n+      fooBar: 'fooBar',\n+      bar_foo: 'bar_foo'\n+    }]))\n+\n+    it('should not alter CamelCase column names', function (done) {\n+      var foo = siDefault.make('foo')\n+\n+      foo.list$({native$: 'SELECT * FROM foo where \"fooBar\" = \\'fooBar\\''}, function (err, res) {\n+        expect(err).to.not.exist()\n+        expect(res.length).to.equal(1)\n+\n+        done()\n+      })\n+    })\n+\n+    it('should not alter snake_case column names', function (done) {\n+      var foo = siDefault.make('foo')\n+\n+      foo.list$({native$: 'SELECT * FROM foo where bar_foo = \\'bar_foo\\''}, function (err, res) {\n+        expect(err).to.not.exist()\n+        expect(res.length).to.equal(1)\n+\n+        done()\n+      })\n+    })\n+  })\n+\n+  describe('Custom CamelCase to snake_case conversion', function () {\n+    var UpperCaseRegExp = /[A-Z]/g\n+\n+    // Replace \"camelCase\" with \"camel_case\"\n+    function camelToSnakeCase (field) {\n+      UpperCaseRegExp.lastIndex = 0\n+      return field.replace(UpperCaseRegExp, function (str, offset) {\n+        return ('_' + str.toLowerCase())\n+      })\n+    }\n+\n+    // Replace \"snake_case\" with \"snakeCase\"\n+    function snakeToCamelCase (column) {\n+      var arr = column.split('_')\n+      var field = arr[0]\n+      for (var i = 1; i < arr.length; i++) {\n+        field += arr[i][0].toUpperCase() + arr[i].slice(1, arr[i].length)\n+      }\n+\n+      return field\n+    }\n+\n+    before({}, function (done) {\n+      var caseConverter = {\n+        toColumnName: camelToSnakeCase,\n+        fromColumnName: snakeToCamelCase\n+      }\n+      var Config = _.assign({}, DefaultConfig, caseConverter)\n+\n+      siCustom.use(require('..'), Config)\n+      siCustom.ready(function () {\n+        siCustom.use(require('seneca-store-query'))\n+        siCustom.ready(done)\n+      })\n+    })\n+\n+    beforeEach(clearDb(siCustom))\n+    beforeEach(createEntities(siCustom, 'foo', [{\n+      barFoo: 'barFoo'\n+    }]))\n+\n+    it('should convert the CamelCase column name to snake case', function (done) {\n+      var foo = siCustom.make('foo')\n+\n+      foo.list$({native$: 'SELECT * FROM foo where \"bar_foo\" = \\'fooBar\\''}, function (err, res) {","path":"test/postgres.test.js","position":108,"original_position":108,"commit_id":"a8515899ff67ae4436d5aa3294d03e8effd4805a","original_commit_id":"a8515899ff67ae4436d5aa3294d03e8effd4805a","user":{"login":"floridemai","id":1158133,"avatar_url":"https://avatars.githubusercontent.com/u/1158133?v=3","gravatar_id":"","url":"https://api.github.com/users/floridemai","html_url":"https://github.com/floridemai","followers_url":"https://api.github.com/users/floridemai/followers","following_url":"https://api.github.com/users/floridemai/following{/other_user}","gists_url":"https://api.github.com/users/floridemai/gists{/gist_id}","starred_url":"https://api.github.com/users/floridemai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/floridemai/subscriptions","organizations_url":"https://api.github.com/users/floridemai/orgs","repos_url":"https://api.github.com/users/floridemai/repos","events_url":"https://api.github.com/users/floridemai/events{/privacy}","received_events_url":"https://api.github.com/users/floridemai/received_events","type":"User","site_admin":false},"body":"Is this actually returning something cause it thin it should not. I think. You should create an entity: `{barFoo: 'value'}` save that to foo table and then `SELECT * FROM foo WHERE bar_foo = 'value'`?\r\nAnd this is to demonstrate that this works from object to table. You should also do a select and check that the returned object has `barFoo` and not `bar_foo` as it is in the database. So another test should be written","created_at":"2016-04-08T07:41:34Z","updated_at":"2016-04-08T07:41:34Z","html_url":"https://github.com/senecajs/seneca-postgres-store/pull/38#discussion_r58990185","pull_request_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/pulls/38","_links":{"self":{"href":"https://api.github.com/repos/senecajs/seneca-postgres-store/pulls/comments/58990185"},"html":{"href":"https://github.com/senecajs/seneca-postgres-store/pull/38#discussion_r58990185"},"pull_request":{"href":"https://api.github.com/repos/senecajs/seneca-postgres-store/pulls/38"}}},"pull_request":{"url":"https://api.github.com/repos/senecajs/seneca-postgres-store/pulls/38","id":65659467,"html_url":"https://github.com/senecajs/seneca-postgres-store/pull/38","diff_url":"https://github.com/senecajs/seneca-postgres-store/pull/38.diff","patch_url":"https://github.com/senecajs/seneca-postgres-store/pull/38.patch","issue_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/issues/38","number":38,"state":"open","locked":false,"title":"Backward compatible test sample","user":{"login":"mihaidma","id":4950500,"avatar_url":"https://avatars.githubusercontent.com/u/4950500?v=3","gravatar_id":"","url":"https://api.github.com/users/mihaidma","html_url":"https://github.com/mihaidma","followers_url":"https://api.github.com/users/mihaidma/followers","following_url":"https://api.github.com/users/mihaidma/following{/other_user}","gists_url":"https://api.github.com/users/mihaidma/gists{/gist_id}","starred_url":"https://api.github.com/users/mihaidma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mihaidma/subscriptions","organizations_url":"https://api.github.com/users/mihaidma/orgs","repos_url":"https://api.github.com/users/mihaidma/repos","events_url":"https://api.github.com/users/mihaidma/events{/privacy}","received_events_url":"https://api.github.com/users/mihaidma/received_events","type":"User","site_admin":false},"body":"Verifies that by default the CamelCase column names are not converted to snake_case\r\nTests a custom column name converter that converts CamelCase column names to snake_case database columns. This sample will be used to ensure backward compatibility with apps built with 1.x postgres stores.","created_at":"2016-04-07T16:25:52Z","updated_at":"2016-04-08T07:41:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9554893a9170290669bb53e6ebafdf1df16eca2b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/pulls/38/commits","review_comments_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/pulls/38/comments","review_comment_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/pulls/comments{/number}","comments_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/issues/38/comments","statuses_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/statuses/a8515899ff67ae4436d5aa3294d03e8effd4805a","head":{"label":"senecajs:testsample","ref":"testsample","sha":"a8515899ff67ae4436d5aa3294d03e8effd4805a","user":{"login":"senecajs","id":10085488,"avatar_url":"https://avatars.githubusercontent.com/u/10085488?v=3","gravatar_id":"","url":"https://api.github.com/users/senecajs","html_url":"https://github.com/senecajs","followers_url":"https://api.github.com/users/senecajs/followers","following_url":"https://api.github.com/users/senecajs/following{/other_user}","gists_url":"https://api.github.com/users/senecajs/gists{/gist_id}","starred_url":"https://api.github.com/users/senecajs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/senecajs/subscriptions","organizations_url":"https://api.github.com/users/senecajs/orgs","repos_url":"https://api.github.com/users/senecajs/repos","events_url":"https://api.github.com/users/senecajs/events{/privacy}","received_events_url":"https://api.github.com/users/senecajs/received_events","type":"Organization","site_admin":false},"repo":{"id":6899106,"name":"seneca-postgres-store","full_name":"senecajs/seneca-postgres-store","owner":{"login":"senecajs","id":10085488,"avatar_url":"https://avatars.githubusercontent.com/u/10085488?v=3","gravatar_id":"","url":"https://api.github.com/users/senecajs","html_url":"https://github.com/senecajs","followers_url":"https://api.github.com/users/senecajs/followers","following_url":"https://api.github.com/users/senecajs/following{/other_user}","gists_url":"https://api.github.com/users/senecajs/gists{/gist_id}","starred_url":"https://api.github.com/users/senecajs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/senecajs/subscriptions","organizations_url":"https://api.github.com/users/senecajs/orgs","repos_url":"https://api.github.com/users/senecajs/repos","events_url":"https://api.github.com/users/senecajs/events{/privacy}","received_events_url":"https://api.github.com/users/senecajs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/senecajs/seneca-postgres-store","description":"PostgreSQL plugin for Seneca","fork":false,"url":"https://api.github.com/repos/senecajs/seneca-postgres-store","forks_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/forks","keys_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/keys{/key_id}","collaborators_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/teams","hooks_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/hooks","issue_events_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/issues/events{/number}","events_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/events","assignees_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/assignees{/user}","branches_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/branches{/branch}","tags_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/tags","blobs_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/git/refs{/sha}","trees_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/git/trees{/sha}","statuses_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/statuses/{sha}","languages_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/languages","stargazers_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/stargazers","contributors_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/contributors","subscribers_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/subscribers","subscription_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/subscription","commits_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/commits{/sha}","git_commits_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/git/commits{/sha}","comments_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/comments{/number}","issue_comment_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/issues/comments{/number}","contents_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/contents/{+path}","compare_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/compare/{base}...{head}","merges_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/merges","archive_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/downloads","issues_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/issues{/number}","pulls_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/pulls{/number}","milestones_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/milestones{/number}","notifications_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/labels{/name}","releases_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/releases{/id}","deployments_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/deployments","created_at":"2012-11-28T09:01:42Z","updated_at":"2016-02-23T12:58:10Z","pushed_at":"2016-04-07T16:38:54Z","git_url":"git://github.com/senecajs/seneca-postgres-store.git","ssh_url":"git@github.com:senecajs/seneca-postgres-store.git","clone_url":"https://github.com/senecajs/seneca-postgres-store.git","svn_url":"https://github.com/senecajs/seneca-postgres-store","homepage":"","size":169,"stargazers_count":6,"watchers_count":6,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":23,"mirror_url":null,"open_issues_count":11,"forks":23,"open_issues":11,"watchers":6,"default_branch":"master"}},"base":{"label":"senecajs:master","ref":"master","sha":"f60b1a825704a22ffdb9adf062f1c4823afd1476","user":{"login":"senecajs","id":10085488,"avatar_url":"https://avatars.githubusercontent.com/u/10085488?v=3","gravatar_id":"","url":"https://api.github.com/users/senecajs","html_url":"https://github.com/senecajs","followers_url":"https://api.github.com/users/senecajs/followers","following_url":"https://api.github.com/users/senecajs/following{/other_user}","gists_url":"https://api.github.com/users/senecajs/gists{/gist_id}","starred_url":"https://api.github.com/users/senecajs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/senecajs/subscriptions","organizations_url":"https://api.github.com/users/senecajs/orgs","repos_url":"https://api.github.com/users/senecajs/repos","events_url":"https://api.github.com/users/senecajs/events{/privacy}","received_events_url":"https://api.github.com/users/senecajs/received_events","type":"Organization","site_admin":false},"repo":{"id":6899106,"name":"seneca-postgres-store","full_name":"senecajs/seneca-postgres-store","owner":{"login":"senecajs","id":10085488,"avatar_url":"https://avatars.githubusercontent.com/u/10085488?v=3","gravatar_id":"","url":"https://api.github.com/users/senecajs","html_url":"https://github.com/senecajs","followers_url":"https://api.github.com/users/senecajs/followers","following_url":"https://api.github.com/users/senecajs/following{/other_user}","gists_url":"https://api.github.com/users/senecajs/gists{/gist_id}","starred_url":"https://api.github.com/users/senecajs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/senecajs/subscriptions","organizations_url":"https://api.github.com/users/senecajs/orgs","repos_url":"https://api.github.com/users/senecajs/repos","events_url":"https://api.github.com/users/senecajs/events{/privacy}","received_events_url":"https://api.github.com/users/senecajs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/senecajs/seneca-postgres-store","description":"PostgreSQL plugin for Seneca","fork":false,"url":"https://api.github.com/repos/senecajs/seneca-postgres-store","forks_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/forks","keys_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/keys{/key_id}","collaborators_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/teams","hooks_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/hooks","issue_events_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/issues/events{/number}","events_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/events","assignees_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/assignees{/user}","branches_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/branches{/branch}","tags_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/tags","blobs_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/git/refs{/sha}","trees_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/git/trees{/sha}","statuses_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/statuses/{sha}","languages_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/languages","stargazers_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/stargazers","contributors_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/contributors","subscribers_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/subscribers","subscription_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/subscription","commits_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/commits{/sha}","git_commits_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/git/commits{/sha}","comments_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/comments{/number}","issue_comment_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/issues/comments{/number}","contents_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/contents/{+path}","compare_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/compare/{base}...{head}","merges_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/merges","archive_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/downloads","issues_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/issues{/number}","pulls_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/pulls{/number}","milestones_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/milestones{/number}","notifications_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/labels{/name}","releases_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/releases{/id}","deployments_url":"https://api.github.com/repos/senecajs/seneca-postgres-store/deployments","created_at":"2012-11-28T09:01:42Z","updated_at":"2016-02-23T12:58:10Z","pushed_at":"2016-04-07T16:38:54Z","git_url":"git://github.com/senecajs/seneca-postgres-store.git","ssh_url":"git@github.com:senecajs/seneca-postgres-store.git","clone_url":"https://github.com/senecajs/seneca-postgres-store.git","svn_url":"https://github.com/senecajs/seneca-postgres-store","homepage":"","size":169,"stargazers_count":6,"watchers_count":6,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":23,"mirror_url":null,"open_issues_count":11,"forks":23,"open_issues":11,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/senecajs/seneca-postgres-store/pulls/38"},"html":{"href":"https://github.com/senecajs/seneca-postgres-store/pull/38"},"issue":{"href":"https://api.github.com/repos/senecajs/seneca-postgres-store/issues/38"},"comments":{"href":"https://api.github.com/repos/senecajs/seneca-postgres-store/issues/38/comments"},"review_comments":{"href":"https://api.github.com/repos/senecajs/seneca-postgres-store/pulls/38/comments"},"review_comment":{"href":"https://api.github.com/repos/senecajs/seneca-postgres-store/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/senecajs/seneca-postgres-store/pulls/38/commits"},"statuses":{"href":"https://api.github.com/repos/senecajs/seneca-postgres-store/statuses/a8515899ff67ae4436d5aa3294d03e8effd4805a"}}}}