{"action":"created","comment":{"url":"https://api.github.com/repos/youknowriad/intercom2db/pulls/comments/34417120","id":34417120,"diff_hunk":"@@ -0,0 +1,59 @@\n+var Promise = require('bluebird');\n+\n+module.exports = function(connexion, schema) {\n+  var usersTable = schema.toSQL() + 'users';\n+  var usersAttributesTable = schema.toSQL() + 'user_custom_attributes';\n+  var usersTagsTable = schema.toSQL() + 'INSERT';\n+  var usersSegmentsTable = schema.toSQL() + 'user_segments';\n+\n+  this.prepare = function(connexion) {\n+    return connexion.query('DELETE FROM ' + usersTable, { type: connexion.QueryTypes.DELETE });\n+  };\n+\n+  this.process = function(user) {\n+    var companyId = user.companies.companies.length > 0 ? user.companies.companies[0].id : null;\n+\n+    return connexion.query('INSERT INTO ' + usersTable + '(id, user_id, name, email, pseudonym, city_name, continent_code, country_name, latitude, longitude, postal_code, region_name, timezone, country_code, last_request_at, last_seen_ip, created_at, signed_up_at, updated_at, session_count, user_agent_data, company_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', {\n+      type: connexion.QueryTypes.INSERT,\n+      replacements: [user.id, user.user_id, user.name, user.email, user.pseudonyme, user.location_data.city_name, user.location_data.continent_code, user.location_data.country_name, user.location_data.latitude, user.location_data.longitude, user.location_data.postal_code, user.location_data.region_name, user.location_data.timezone, user.location_data.country_code, user.last_request_at, user.last_seen_ip, user.created_at, user.signed_up_at, user.updated_at, user.session_count, user.user_agent_data, companyId]\n+    }).then(function() {\n+      var promises = [];\n+\n+      if (user.custom_attributes) {","path":"src/importer/users-importer.js","position":22,"original_position":22,"commit_id":"dc1119220d55ff413d1b478abd42c7366d11f646","original_commit_id":"dc1119220d55ff413d1b478abd42c7366d11f646","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Identifier 'custom_attributes' is not in camel case.","created_at":"2015-07-11T23:09:58Z","updated_at":"2015-07-11T23:09:58Z","html_url":"https://github.com/youknowriad/intercom2db/pull/5#discussion_r34417120","pull_request_url":"https://api.github.com/repos/youknowriad/intercom2db/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/youknowriad/intercom2db/pulls/comments/34417120"},"html":{"href":"https://github.com/youknowriad/intercom2db/pull/5#discussion_r34417120"},"pull_request":{"href":"https://api.github.com/repos/youknowriad/intercom2db/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/youknowriad/intercom2db/pulls/5","id":39639286,"html_url":"https://github.com/youknowriad/intercom2db/pull/5","diff_url":"https://github.com/youknowriad/intercom2db/pull/5.diff","patch_url":"https://github.com/youknowriad/intercom2db/pull/5.patch","issue_url":"https://api.github.com/repos/youknowriad/intercom2db/issues/5","number":5,"state":"open","locked":false,"title":"Sequelize...","user":{"login":"jubianchi","id":327237,"avatar_url":"https://avatars.githubusercontent.com/u/327237?v=3","gravatar_id":"","url":"https://api.github.com/users/jubianchi","html_url":"https://github.com/jubianchi","followers_url":"https://api.github.com/users/jubianchi/followers","following_url":"https://api.github.com/users/jubianchi/following{/other_user}","gists_url":"https://api.github.com/users/jubianchi/gists{/gist_id}","starred_url":"https://api.github.com/users/jubianchi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jubianchi/subscriptions","organizations_url":"https://api.github.com/users/jubianchi/orgs","repos_url":"https://api.github.com/users/jubianchi/repos","events_url":"https://api.github.com/users/jubianchi/events{/privacy}","received_events_url":"https://api.github.com/users/jubianchi/received_events","type":"User","site_admin":false},"body":"...and add some features\r\n\r\n* Uses sequelize, supports more RDMS\r\n* Import users/companies' custom attributes\r\n* Import conversations\r\n* Auto-refresh data with a configurable delay (`I2DB_REFRESH_DELAY`)","created_at":"2015-07-09T23:29:50Z","updated_at":"2015-07-11T23:09:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"397d1f62774d7d82cc899367175818d4d81856a5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/youknowriad/intercom2db/pulls/5/commits","review_comments_url":"https://api.github.com/repos/youknowriad/intercom2db/pulls/5/comments","review_comment_url":"https://api.github.com/repos/youknowriad/intercom2db/pulls/comments{/number}","comments_url":"https://api.github.com/repos/youknowriad/intercom2db/issues/5/comments","statuses_url":"https://api.github.com/repos/youknowriad/intercom2db/statuses/dc1119220d55ff413d1b478abd42c7366d11f646","head":{"label":"jubianchi:sequelize","ref":"sequelize","sha":"dc1119220d55ff413d1b478abd42c7366d11f646","user":{"login":"jubianchi","id":327237,"avatar_url":"https://avatars.githubusercontent.com/u/327237?v=3","gravatar_id":"","url":"https://api.github.com/users/jubianchi","html_url":"https://github.com/jubianchi","followers_url":"https://api.github.com/users/jubianchi/followers","following_url":"https://api.github.com/users/jubianchi/following{/other_user}","gists_url":"https://api.github.com/users/jubianchi/gists{/gist_id}","starred_url":"https://api.github.com/users/jubianchi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jubianchi/subscriptions","organizations_url":"https://api.github.com/users/jubianchi/orgs","repos_url":"https://api.github.com/users/jubianchi/repos","events_url":"https://api.github.com/users/jubianchi/events{/privacy}","received_events_url":"https://api.github.com/users/jubianchi/received_events","type":"User","site_admin":false},"repo":{"id":33861257,"name":"intercom2db","full_name":"jubianchi/intercom2db","owner":{"login":"jubianchi","id":327237,"avatar_url":"https://avatars.githubusercontent.com/u/327237?v=3","gravatar_id":"","url":"https://api.github.com/users/jubianchi","html_url":"https://github.com/jubianchi","followers_url":"https://api.github.com/users/jubianchi/followers","following_url":"https://api.github.com/users/jubianchi/following{/other_user}","gists_url":"https://api.github.com/users/jubianchi/gists{/gist_id}","starred_url":"https://api.github.com/users/jubianchi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jubianchi/subscriptions","organizations_url":"https://api.github.com/users/jubianchi/orgs","repos_url":"https://api.github.com/users/jubianchi/repos","events_url":"https://api.github.com/users/jubianchi/events{/privacy}","received_events_url":"https://api.github.com/users/jubianchi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jubianchi/intercom2db","description":"Intercom2db is a small utility that allow you to extract data from http://intercom.io to a database.","fork":true,"url":"https://api.github.com/repos/jubianchi/intercom2db","forks_url":"https://api.github.com/repos/jubianchi/intercom2db/forks","keys_url":"https://api.github.com/repos/jubianchi/intercom2db/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jubianchi/intercom2db/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jubianchi/intercom2db/teams","hooks_url":"https://api.github.com/repos/jubianchi/intercom2db/hooks","issue_events_url":"https://api.github.com/repos/jubianchi/intercom2db/issues/events{/number}","events_url":"https://api.github.com/repos/jubianchi/intercom2db/events","assignees_url":"https://api.github.com/repos/jubianchi/intercom2db/assignees{/user}","branches_url":"https://api.github.com/repos/jubianchi/intercom2db/branches{/branch}","tags_url":"https://api.github.com/repos/jubianchi/intercom2db/tags","blobs_url":"https://api.github.com/repos/jubianchi/intercom2db/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jubianchi/intercom2db/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jubianchi/intercom2db/git/refs{/sha}","trees_url":"https://api.github.com/repos/jubianchi/intercom2db/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jubianchi/intercom2db/statuses/{sha}","languages_url":"https://api.github.com/repos/jubianchi/intercom2db/languages","stargazers_url":"https://api.github.com/repos/jubianchi/intercom2db/stargazers","contributors_url":"https://api.github.com/repos/jubianchi/intercom2db/contributors","subscribers_url":"https://api.github.com/repos/jubianchi/intercom2db/subscribers","subscription_url":"https://api.github.com/repos/jubianchi/intercom2db/subscription","commits_url":"https://api.github.com/repos/jubianchi/intercom2db/commits{/sha}","git_commits_url":"https://api.github.com/repos/jubianchi/intercom2db/git/commits{/sha}","comments_url":"https://api.github.com/repos/jubianchi/intercom2db/comments{/number}","issue_comment_url":"https://api.github.com/repos/jubianchi/intercom2db/issues/comments{/number}","contents_url":"https://api.github.com/repos/jubianchi/intercom2db/contents/{+path}","compare_url":"https://api.github.com/repos/jubianchi/intercom2db/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jubianchi/intercom2db/merges","archive_url":"https://api.github.com/repos/jubianchi/intercom2db/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jubianchi/intercom2db/downloads","issues_url":"https://api.github.com/repos/jubianchi/intercom2db/issues{/number}","pulls_url":"https://api.github.com/repos/jubianchi/intercom2db/pulls{/number}","milestones_url":"https://api.github.com/repos/jubianchi/intercom2db/milestones{/number}","notifications_url":"https://api.github.com/repos/jubianchi/intercom2db/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jubianchi/intercom2db/labels{/name}","releases_url":"https://api.github.com/repos/jubianchi/intercom2db/releases{/id}","created_at":"2015-04-13T10:03:24Z","updated_at":"2015-04-13T10:03:25Z","pushed_at":"2015-07-11T23:09:49Z","git_url":"git://github.com/jubianchi/intercom2db.git","ssh_url":"git@github.com:jubianchi/intercom2db.git","clone_url":"https://github.com/jubianchi/intercom2db.git","svn_url":"https://github.com/jubianchi/intercom2db","homepage":null,"size":109,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"youknowriad:master","ref":"master","sha":"81f94443e1fb99d9d08c142b7d4c0e5d18a5b314","user":{"login":"youknowriad","id":272444,"avatar_url":"https://avatars.githubusercontent.com/u/272444?v=3","gravatar_id":"","url":"https://api.github.com/users/youknowriad","html_url":"https://github.com/youknowriad","followers_url":"https://api.github.com/users/youknowriad/followers","following_url":"https://api.github.com/users/youknowriad/following{/other_user}","gists_url":"https://api.github.com/users/youknowriad/gists{/gist_id}","starred_url":"https://api.github.com/users/youknowriad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/youknowriad/subscriptions","organizations_url":"https://api.github.com/users/youknowriad/orgs","repos_url":"https://api.github.com/users/youknowriad/repos","events_url":"https://api.github.com/users/youknowriad/events{/privacy}","received_events_url":"https://api.github.com/users/youknowriad/received_events","type":"User","site_admin":false},"repo":{"id":33772411,"name":"intercom2db","full_name":"youknowriad/intercom2db","owner":{"login":"youknowriad","id":272444,"avatar_url":"https://avatars.githubusercontent.com/u/272444?v=3","gravatar_id":"","url":"https://api.github.com/users/youknowriad","html_url":"https://github.com/youknowriad","followers_url":"https://api.github.com/users/youknowriad/followers","following_url":"https://api.github.com/users/youknowriad/following{/other_user}","gists_url":"https://api.github.com/users/youknowriad/gists{/gist_id}","starred_url":"https://api.github.com/users/youknowriad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/youknowriad/subscriptions","organizations_url":"https://api.github.com/users/youknowriad/orgs","repos_url":"https://api.github.com/users/youknowriad/repos","events_url":"https://api.github.com/users/youknowriad/events{/privacy}","received_events_url":"https://api.github.com/users/youknowriad/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/youknowriad/intercom2db","description":"Intercom2db is a small utility that allow you to extract data from http://intercom.io to a database.","fork":false,"url":"https://api.github.com/repos/youknowriad/intercom2db","forks_url":"https://api.github.com/repos/youknowriad/intercom2db/forks","keys_url":"https://api.github.com/repos/youknowriad/intercom2db/keys{/key_id}","collaborators_url":"https://api.github.com/repos/youknowriad/intercom2db/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/youknowriad/intercom2db/teams","hooks_url":"https://api.github.com/repos/youknowriad/intercom2db/hooks","issue_events_url":"https://api.github.com/repos/youknowriad/intercom2db/issues/events{/number}","events_url":"https://api.github.com/repos/youknowriad/intercom2db/events","assignees_url":"https://api.github.com/repos/youknowriad/intercom2db/assignees{/user}","branches_url":"https://api.github.com/repos/youknowriad/intercom2db/branches{/branch}","tags_url":"https://api.github.com/repos/youknowriad/intercom2db/tags","blobs_url":"https://api.github.com/repos/youknowriad/intercom2db/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/youknowriad/intercom2db/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/youknowriad/intercom2db/git/refs{/sha}","trees_url":"https://api.github.com/repos/youknowriad/intercom2db/git/trees{/sha}","statuses_url":"https://api.github.com/repos/youknowriad/intercom2db/statuses/{sha}","languages_url":"https://api.github.com/repos/youknowriad/intercom2db/languages","stargazers_url":"https://api.github.com/repos/youknowriad/intercom2db/stargazers","contributors_url":"https://api.github.com/repos/youknowriad/intercom2db/contributors","subscribers_url":"https://api.github.com/repos/youknowriad/intercom2db/subscribers","subscription_url":"https://api.github.com/repos/youknowriad/intercom2db/subscription","commits_url":"https://api.github.com/repos/youknowriad/intercom2db/commits{/sha}","git_commits_url":"https://api.github.com/repos/youknowriad/intercom2db/git/commits{/sha}","comments_url":"https://api.github.com/repos/youknowriad/intercom2db/comments{/number}","issue_comment_url":"https://api.github.com/repos/youknowriad/intercom2db/issues/comments{/number}","contents_url":"https://api.github.com/repos/youknowriad/intercom2db/contents/{+path}","compare_url":"https://api.github.com/repos/youknowriad/intercom2db/compare/{base}...{head}","merges_url":"https://api.github.com/repos/youknowriad/intercom2db/merges","archive_url":"https://api.github.com/repos/youknowriad/intercom2db/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/youknowriad/intercom2db/downloads","issues_url":"https://api.github.com/repos/youknowriad/intercom2db/issues{/number}","pulls_url":"https://api.github.com/repos/youknowriad/intercom2db/pulls{/number}","milestones_url":"https://api.github.com/repos/youknowriad/intercom2db/milestones{/number}","notifications_url":"https://api.github.com/repos/youknowriad/intercom2db/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/youknowriad/intercom2db/labels{/name}","releases_url":"https://api.github.com/repos/youknowriad/intercom2db/releases{/id}","created_at":"2015-04-11T10:50:59Z","updated_at":"2015-04-17T17:37:40Z","pushed_at":"2015-07-11T23:09:49Z","git_url":"git://github.com/youknowriad/intercom2db.git","ssh_url":"git@github.com:youknowriad/intercom2db.git","clone_url":"https://github.com/youknowriad/intercom2db.git","svn_url":"https://github.com/youknowriad/intercom2db","homepage":null,"size":171,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/youknowriad/intercom2db/pulls/5"},"html":{"href":"https://github.com/youknowriad/intercom2db/pull/5"},"issue":{"href":"https://api.github.com/repos/youknowriad/intercom2db/issues/5"},"comments":{"href":"https://api.github.com/repos/youknowriad/intercom2db/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/youknowriad/intercom2db/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/youknowriad/intercom2db/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/youknowriad/intercom2db/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/youknowriad/intercom2db/statuses/dc1119220d55ff413d1b478abd42c7366d11f646"}}}}