{"action":"created","comment":{"url":"https://api.github.com/repos/linagora/james-project/pulls/comments/125408340","pull_request_review_id":47793445,"id":125408340,"diff_hunk":"@@ -0,0 +1,67 @@\n+/****************************************************************\n+ * Licensed to the Apache Software Foundation (ASF) under one   *\n+ * or more contributor license agreements.  See the NOTICE file *\n+ * distributed with this work for additional information        *\n+ * regarding copyright ownership.  The ASF licenses this file   *\n+ * to you under the Apache License, Version 2.0 (the            *\n+ * \"License\"); you may not use this file except in compliance   *\n+ * with the License.  You may obtain a copy of the License at   *\n+ *                                                              *\n+ *   http://www.apache.org/licenses/LICENSE-2.0                 *\n+ *                                                              *\n+ * Unless required by applicable law or agreed to in writing,   *\n+ * software distributed under the License is distributed on an  *\n+ * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *\n+ * KIND, either express or implied.  See the License for the    *\n+ * specific language governing permissions and limitations      *\n+ * under the License.                                           *\n+ ****************************************************************/\n+\n+package org.apache.james.mailbox.cassandra.mail;\n+\n+import com.datastax.driver.core.PreparedStatement;\n+import com.datastax.driver.core.Row;\n+import com.datastax.driver.core.Session;\n+import org.apache.james.backends.cassandra.utils.CassandraAsyncExecutor;\n+import static org.apache.james.mailbox.cassandra.table.CassandraSchemaVersionTable.TABLE_NAME;\n+import static org.apache.james.mailbox.cassandra.table.CassandraSchemaVersionTable.KEY;\n+import static org.apache.james.mailbox.cassandra.table.CassandraSchemaVersionTable.VALUE;\n+\n+import java.util.concurrent.CompletableFuture;\n+\n+import static com.datastax.driver.core.querybuilder.QueryBuilder.eq;\n+import static com.datastax.driver.core.querybuilder.QueryBuilder.select;\n+\n+public class CassandraSchemaVersionDAO {\n+\n+    public static final int DEFAULT_VERSION = 1;\n+    public static final int KEY_FOR_VERSION = 0;\n+\n+    private final PreparedStatement readVersionStatement;\n+    private final CassandraAsyncExecutor cassandraAsyncExecutor;\n+\n+    public CassandraSchemaVersionDAO(Session session) {\n+        cassandraAsyncExecutor = new CassandraAsyncExecutor(session);\n+        readVersionStatement = prepareReadVersionStatement(session);\n+    }\n+\n+    private static int versionFromRow(Row row) {\n+        return row.getInt(VALUE);\n+    }\n+\n+    private PreparedStatement prepareReadVersionStatement(Session session) {\n+        return session.prepare(\n+            select(VALUE)\n+                .from(TABLE_NAME)\n+                .where(eq(KEY, KEY_FOR_VERSION)));\n+    }\n+\n+    public CompletableFuture<Integer> getCurrentSchemaVersion() {","path":"mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraSchemaVersionDAO.java","position":null,"original_position":59,"commit_id":"1ff46d73edf927475b19e26e4ab05257f25785e6","original_commit_id":"fa522866c47ec30cddf24b3607212b9a802cdb32","user":{"login":"strokyl","id":173588,"avatar_url":"https://avatars3.githubusercontent.com/u/173588?v=3","gravatar_id":"","url":"https://api.github.com/users/strokyl","html_url":"https://github.com/strokyl","followers_url":"https://api.github.com/users/strokyl/followers","following_url":"https://api.github.com/users/strokyl/following{/other_user}","gists_url":"https://api.github.com/users/strokyl/gists{/gist_id}","starred_url":"https://api.github.com/users/strokyl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strokyl/subscriptions","organizations_url":"https://api.github.com/users/strokyl/orgs","repos_url":"https://api.github.com/users/strokyl/repos","events_url":"https://api.github.com/users/strokyl/events{/privacy}","received_events_url":"https://api.github.com/users/strokyl/received_events","type":"User","site_admin":false},"body":"Yes I wanted to move the default version to the manager but I did not have time to do that before pushing","created_at":"2017-07-04T07:46:46Z","updated_at":"2017-07-04T07:46:46Z","html_url":"https://github.com/linagora/james-project/pull/876#discussion_r125408340","pull_request_url":"https://api.github.com/repos/linagora/james-project/pulls/876","_links":{"self":{"href":"https://api.github.com/repos/linagora/james-project/pulls/comments/125408340"},"html":{"href":"https://github.com/linagora/james-project/pull/876#discussion_r125408340"},"pull_request":{"href":"https://api.github.com/repos/linagora/james-project/pulls/876"}}},"pull_request":{"url":"https://api.github.com/repos/linagora/james-project/pulls/876","id":128658588,"html_url":"https://github.com/linagora/james-project/pull/876","diff_url":"https://github.com/linagora/james-project/pull/876.diff","patch_url":"https://github.com/linagora/james-project/pull/876.patch","issue_url":"https://api.github.com/repos/linagora/james-project/issues/876","number":876,"state":"open","locked":false,"title":"James 2083 cassandra migration (WIP)","user":{"login":"strokyl","id":173588,"avatar_url":"https://avatars3.githubusercontent.com/u/173588?v=3","gravatar_id":"","url":"https://api.github.com/users/strokyl","html_url":"https://github.com/strokyl","followers_url":"https://api.github.com/users/strokyl/followers","following_url":"https://api.github.com/users/strokyl/following{/other_user}","gists_url":"https://api.github.com/users/strokyl/gists{/gist_id}","starred_url":"https://api.github.com/users/strokyl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strokyl/subscriptions","organizations_url":"https://api.github.com/users/strokyl/orgs","repos_url":"https://api.github.com/users/strokyl/repos","events_url":"https://api.github.com/users/strokyl/events{/privacy}","received_events_url":"https://api.github.com/users/strokyl/received_events","type":"User","site_admin":false},"body":"It miss some cleaning:\r\n - DAO should not replace Nothing by default value but let the manager doing that\r\n - when no schema version in cassandra a warn log should be displayed IMO\r\n\r\n- it miss a integration test.","created_at":"2017-07-03T16:03:23Z","updated_at":"2017-07-04T07:46:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"292efcc4b15fe8d5b39e7641c4e1990817f0bbb6","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/linagora/james-project/pulls/876/commits","review_comments_url":"https://api.github.com/repos/linagora/james-project/pulls/876/comments","review_comment_url":"https://api.github.com/repos/linagora/james-project/pulls/comments{/number}","comments_url":"https://api.github.com/repos/linagora/james-project/issues/876/comments","statuses_url":"https://api.github.com/repos/linagora/james-project/statuses/1ff46d73edf927475b19e26e4ab05257f25785e6","head":{"label":"strokyl:JAMES-2083_cassandra_migration","ref":"JAMES-2083_cassandra_migration","sha":"1ff46d73edf927475b19e26e4ab05257f25785e6","user":{"login":"strokyl","id":173588,"avatar_url":"https://avatars3.githubusercontent.com/u/173588?v=3","gravatar_id":"","url":"https://api.github.com/users/strokyl","html_url":"https://github.com/strokyl","followers_url":"https://api.github.com/users/strokyl/followers","following_url":"https://api.github.com/users/strokyl/following{/other_user}","gists_url":"https://api.github.com/users/strokyl/gists{/gist_id}","starred_url":"https://api.github.com/users/strokyl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strokyl/subscriptions","organizations_url":"https://api.github.com/users/strokyl/orgs","repos_url":"https://api.github.com/users/strokyl/repos","events_url":"https://api.github.com/users/strokyl/events{/privacy}","received_events_url":"https://api.github.com/users/strokyl/received_events","type":"User","site_admin":false},"repo":{"id":78030099,"name":"james-project","full_name":"strokyl/james-project","owner":{"login":"strokyl","id":173588,"avatar_url":"https://avatars3.githubusercontent.com/u/173588?v=3","gravatar_id":"","url":"https://api.github.com/users/strokyl","html_url":"https://github.com/strokyl","followers_url":"https://api.github.com/users/strokyl/followers","following_url":"https://api.github.com/users/strokyl/following{/other_user}","gists_url":"https://api.github.com/users/strokyl/gists{/gist_id}","starred_url":"https://api.github.com/users/strokyl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strokyl/subscriptions","organizations_url":"https://api.github.com/users/strokyl/orgs","repos_url":"https://api.github.com/users/strokyl/repos","events_url":"https://api.github.com/users/strokyl/events{/privacy}","received_events_url":"https://api.github.com/users/strokyl/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/strokyl/james-project","description":"Mirror of Apache James Project","fork":true,"url":"https://api.github.com/repos/strokyl/james-project","forks_url":"https://api.github.com/repos/strokyl/james-project/forks","keys_url":"https://api.github.com/repos/strokyl/james-project/keys{/key_id}","collaborators_url":"https://api.github.com/repos/strokyl/james-project/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/strokyl/james-project/teams","hooks_url":"https://api.github.com/repos/strokyl/james-project/hooks","issue_events_url":"https://api.github.com/repos/strokyl/james-project/issues/events{/number}","events_url":"https://api.github.com/repos/strokyl/james-project/events","assignees_url":"https://api.github.com/repos/strokyl/james-project/assignees{/user}","branches_url":"https://api.github.com/repos/strokyl/james-project/branches{/branch}","tags_url":"https://api.github.com/repos/strokyl/james-project/tags","blobs_url":"https://api.github.com/repos/strokyl/james-project/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/strokyl/james-project/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/strokyl/james-project/git/refs{/sha}","trees_url":"https://api.github.com/repos/strokyl/james-project/git/trees{/sha}","statuses_url":"https://api.github.com/repos/strokyl/james-project/statuses/{sha}","languages_url":"https://api.github.com/repos/strokyl/james-project/languages","stargazers_url":"https://api.github.com/repos/strokyl/james-project/stargazers","contributors_url":"https://api.github.com/repos/strokyl/james-project/contributors","subscribers_url":"https://api.github.com/repos/strokyl/james-project/subscribers","subscription_url":"https://api.github.com/repos/strokyl/james-project/subscription","commits_url":"https://api.github.com/repos/strokyl/james-project/commits{/sha}","git_commits_url":"https://api.github.com/repos/strokyl/james-project/git/commits{/sha}","comments_url":"https://api.github.com/repos/strokyl/james-project/comments{/number}","issue_comment_url":"https://api.github.com/repos/strokyl/james-project/issues/comments{/number}","contents_url":"https://api.github.com/repos/strokyl/james-project/contents/{+path}","compare_url":"https://api.github.com/repos/strokyl/james-project/compare/{base}...{head}","merges_url":"https://api.github.com/repos/strokyl/james-project/merges","archive_url":"https://api.github.com/repos/strokyl/james-project/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/strokyl/james-project/downloads","issues_url":"https://api.github.com/repos/strokyl/james-project/issues{/number}","pulls_url":"https://api.github.com/repos/strokyl/james-project/pulls{/number}","milestones_url":"https://api.github.com/repos/strokyl/james-project/milestones{/number}","notifications_url":"https://api.github.com/repos/strokyl/james-project/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/strokyl/james-project/labels{/name}","releases_url":"https://api.github.com/repos/strokyl/james-project/releases{/id}","deployments_url":"https://api.github.com/repos/strokyl/james-project/deployments","created_at":"2017-01-04T15:57:20Z","updated_at":"2017-01-04T15:57:33Z","pushed_at":"2017-07-04T07:30:22Z","git_url":"git://github.com/strokyl/james-project.git","ssh_url":"git@github.com:strokyl/james-project.git","clone_url":"https://github.com/strokyl/james-project.git","svn_url":"https://github.com/strokyl/james-project","homepage":null,"size":22330,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"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":"linagora:master","ref":"master","sha":"02d86a46973646dc03881a0657e90608d81b340f","user":{"login":"linagora","id":1230365,"avatar_url":"https://avatars0.githubusercontent.com/u/1230365?v=3","gravatar_id":"","url":"https://api.github.com/users/linagora","html_url":"https://github.com/linagora","followers_url":"https://api.github.com/users/linagora/followers","following_url":"https://api.github.com/users/linagora/following{/other_user}","gists_url":"https://api.github.com/users/linagora/gists{/gist_id}","starred_url":"https://api.github.com/users/linagora/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linagora/subscriptions","organizations_url":"https://api.github.com/users/linagora/orgs","repos_url":"https://api.github.com/users/linagora/repos","events_url":"https://api.github.com/users/linagora/events{/privacy}","received_events_url":"https://api.github.com/users/linagora/received_events","type":"Organization","site_admin":false},"repo":{"id":39182136,"name":"james-project","full_name":"linagora/james-project","owner":{"login":"linagora","id":1230365,"avatar_url":"https://avatars0.githubusercontent.com/u/1230365?v=3","gravatar_id":"","url":"https://api.github.com/users/linagora","html_url":"https://github.com/linagora","followers_url":"https://api.github.com/users/linagora/followers","following_url":"https://api.github.com/users/linagora/following{/other_user}","gists_url":"https://api.github.com/users/linagora/gists{/gist_id}","starred_url":"https://api.github.com/users/linagora/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linagora/subscriptions","organizations_url":"https://api.github.com/users/linagora/orgs","repos_url":"https://api.github.com/users/linagora/repos","events_url":"https://api.github.com/users/linagora/events{/privacy}","received_events_url":"https://api.github.com/users/linagora/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/linagora/james-project","description":"Mirror of Apache James Project","fork":true,"url":"https://api.github.com/repos/linagora/james-project","forks_url":"https://api.github.com/repos/linagora/james-project/forks","keys_url":"https://api.github.com/repos/linagora/james-project/keys{/key_id}","collaborators_url":"https://api.github.com/repos/linagora/james-project/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/linagora/james-project/teams","hooks_url":"https://api.github.com/repos/linagora/james-project/hooks","issue_events_url":"https://api.github.com/repos/linagora/james-project/issues/events{/number}","events_url":"https://api.github.com/repos/linagora/james-project/events","assignees_url":"https://api.github.com/repos/linagora/james-project/assignees{/user}","branches_url":"https://api.github.com/repos/linagora/james-project/branches{/branch}","tags_url":"https://api.github.com/repos/linagora/james-project/tags","blobs_url":"https://api.github.com/repos/linagora/james-project/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/linagora/james-project/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/linagora/james-project/git/refs{/sha}","trees_url":"https://api.github.com/repos/linagora/james-project/git/trees{/sha}","statuses_url":"https://api.github.com/repos/linagora/james-project/statuses/{sha}","languages_url":"https://api.github.com/repos/linagora/james-project/languages","stargazers_url":"https://api.github.com/repos/linagora/james-project/stargazers","contributors_url":"https://api.github.com/repos/linagora/james-project/contributors","subscribers_url":"https://api.github.com/repos/linagora/james-project/subscribers","subscription_url":"https://api.github.com/repos/linagora/james-project/subscription","commits_url":"https://api.github.com/repos/linagora/james-project/commits{/sha}","git_commits_url":"https://api.github.com/repos/linagora/james-project/git/commits{/sha}","comments_url":"https://api.github.com/repos/linagora/james-project/comments{/number}","issue_comment_url":"https://api.github.com/repos/linagora/james-project/issues/comments{/number}","contents_url":"https://api.github.com/repos/linagora/james-project/contents/{+path}","compare_url":"https://api.github.com/repos/linagora/james-project/compare/{base}...{head}","merges_url":"https://api.github.com/repos/linagora/james-project/merges","archive_url":"https://api.github.com/repos/linagora/james-project/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/linagora/james-project/downloads","issues_url":"https://api.github.com/repos/linagora/james-project/issues{/number}","pulls_url":"https://api.github.com/repos/linagora/james-project/pulls{/number}","milestones_url":"https://api.github.com/repos/linagora/james-project/milestones{/number}","notifications_url":"https://api.github.com/repos/linagora/james-project/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/linagora/james-project/labels{/name}","releases_url":"https://api.github.com/repos/linagora/james-project/releases{/id}","deployments_url":"https://api.github.com/repos/linagora/james-project/deployments","created_at":"2015-07-16T07:04:59Z","updated_at":"2017-06-30T07:13:12Z","pushed_at":"2017-07-04T07:30:23Z","git_url":"git://github.com/linagora/james-project.git","ssh_url":"git@github.com:linagora/james-project.git","clone_url":"https://github.com/linagora/james-project.git","svn_url":"https://github.com/linagora/james-project","homepage":null,"size":22113,"stargazers_count":11,"watchers_count":11,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":28,"forks":17,"open_issues":28,"watchers":11,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/linagora/james-project/pulls/876"},"html":{"href":"https://github.com/linagora/james-project/pull/876"},"issue":{"href":"https://api.github.com/repos/linagora/james-project/issues/876"},"comments":{"href":"https://api.github.com/repos/linagora/james-project/issues/876/comments"},"review_comments":{"href":"https://api.github.com/repos/linagora/james-project/pulls/876/comments"},"review_comment":{"href":"https://api.github.com/repos/linagora/james-project/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/linagora/james-project/pulls/876/commits"},"statuses":{"href":"https://api.github.com/repos/linagora/james-project/statuses/1ff46d73edf927475b19e26e4ab05257f25785e6"}}}}
{"actor":{"display_login":"strokyl"}}