{"action":"closed","number":539,"pull_request":{"url":"https://api.github.com/repos/ruby-china/ruby-china/pulls/539","id":56271935,"html_url":"https://github.com/ruby-china/ruby-china/pull/539","diff_url":"https://github.com/ruby-china/ruby-china/pull/539.diff","patch_url":"https://github.com/ruby-china/ruby-china/pull/539.patch","issue_url":"https://api.github.com/repos/ruby-china/ruby-china/issues/539","number":539,"state":"closed","locked":false,"title":"Use ActiveRecord","user":{"login":"huacnlee","id":5518,"avatar_url":"https://avatars.githubusercontent.com/u/5518?v=3","gravatar_id":"","url":"https://api.github.com/users/huacnlee","html_url":"https://github.com/huacnlee","followers_url":"https://api.github.com/users/huacnlee/followers","following_url":"https://api.github.com/users/huacnlee/following{/other_user}","gists_url":"https://api.github.com/users/huacnlee/gists{/gist_id}","starred_url":"https://api.github.com/users/huacnlee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huacnlee/subscriptions","organizations_url":"https://api.github.com/users/huacnlee/orgs","repos_url":"https://api.github.com/users/huacnlee/repos","events_url":"https://api.github.com/users/huacnlee/events{/privacy}","received_events_url":"https://api.github.com/users/huacnlee/received_events","type":"User","site_admin":false},"body":"TODO:\r\n\r\n- [x] 修复所有的测试用例;\r\n- [x] 实现一键迁移 MongoDB 老数据到新 PostgreSQL 数据库的脚本；\r\n- [x] [spec/models/mongoid/mentionable_spec.rb](https://github.com/ruby-china/ruby-china/blob/80cd9af00cfeeff4b3ef610bfcd29607e85a3388/spec/models/mongoid/mentionable_spec.rb) 的测试被去掉了，需要补回来： \r\n- [x] 本地反复验证\r\n- [x] 确定上线时间 2016-01-23\r\n\r\n## 发布流程\r\n\r\n```\r\n# 暂时停掉所有应用服务\r\n$ cap unicorn:stop\r\n$ cap sidekiq:stop\r\n# 发布新代码到服务器\r\n$ cap deploy:update_code\r\n# 上服务器 rails_root\r\n$ RAILS_ENV=production bundle exec rake db:migrate_to_pg\r\n# 等待数据迁移完成，如果有错误，根据情况临时处理，修改 lib/tasks/db.rake\r\n# 完成以后重启 memcachd\r\n$ sudo service memcached restart\r\n# 启动应用服务\r\n$ cap unicorn:start\r\n$ cap sidekiq:start\r\n```\r\n\r\n### 发布失败回滚方案\r\n\r\n迁移工作都是将 MongoDB 的数据往 PostgreSQL 里面导，原始的内容没有动作，如果发布完以后验证出存在严重问题，可以直接 Capstriano Rollback，然后启动服务就 Ok 了\r\n\r\n```\r\n$ cap deploy:rollback\r\n```","created_at":"2016-01-17T06:59:14Z","updated_at":"2016-01-22T04:09:24Z","closed_at":"2016-01-22T04:09:24Z","merged_at":"2016-01-22T04:09:24Z","merge_commit_sha":"e3fbeb6a95bff573d7fc063e3c8bdf54b06d7c7e","assignee":{"login":"lgn21st","id":7104,"avatar_url":"https://avatars.githubusercontent.com/u/7104?v=3","gravatar_id":"","url":"https://api.github.com/users/lgn21st","html_url":"https://github.com/lgn21st","followers_url":"https://api.github.com/users/lgn21st/followers","following_url":"https://api.github.com/users/lgn21st/following{/other_user}","gists_url":"https://api.github.com/users/lgn21st/gists{/gist_id}","starred_url":"https://api.github.com/users/lgn21st/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lgn21st/subscriptions","organizations_url":"https://api.github.com/users/lgn21st/orgs","repos_url":"https://api.github.com/users/lgn21st/repos","events_url":"https://api.github.com/users/lgn21st/events{/privacy}","received_events_url":"https://api.github.com/users/lgn21st/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/ruby-china/ruby-china/pulls/539/commits","review_comments_url":"https://api.github.com/repos/ruby-china/ruby-china/pulls/539/comments","review_comment_url":"https://api.github.com/repos/ruby-china/ruby-china/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ruby-china/ruby-china/issues/539/comments","statuses_url":"https://api.github.com/repos/ruby-china/ruby-china/statuses/c838f867f041514a774db5f3cf2924b635b3d0e9","head":{"label":"ruby-china:use-activerecord","ref":"use-activerecord","sha":"c838f867f041514a774db5f3cf2924b635b3d0e9","user":{"login":"ruby-china","id":1331033,"avatar_url":"https://avatars.githubusercontent.com/u/1331033?v=3","gravatar_id":"","url":"https://api.github.com/users/ruby-china","html_url":"https://github.com/ruby-china","followers_url":"https://api.github.com/users/ruby-china/followers","following_url":"https://api.github.com/users/ruby-china/following{/other_user}","gists_url":"https://api.github.com/users/ruby-china/gists{/gist_id}","starred_url":"https://api.github.com/users/ruby-china/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruby-china/subscriptions","organizations_url":"https://api.github.com/users/ruby-china/orgs","repos_url":"https://api.github.com/users/ruby-china/repos","events_url":"https://api.github.com/users/ruby-china/events{/privacy}","received_events_url":"https://api.github.com/users/ruby-china/received_events","type":"Organization","site_admin":false},"repo":{"id":3842593,"name":"ruby-china","full_name":"ruby-china/ruby-china","owner":{"login":"ruby-china","id":1331033,"avatar_url":"https://avatars.githubusercontent.com/u/1331033?v=3","gravatar_id":"","url":"https://api.github.com/users/ruby-china","html_url":"https://github.com/ruby-china","followers_url":"https://api.github.com/users/ruby-china/followers","following_url":"https://api.github.com/users/ruby-china/following{/other_user}","gists_url":"https://api.github.com/users/ruby-china/gists{/gist_id}","starred_url":"https://api.github.com/users/ruby-china/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruby-china/subscriptions","organizations_url":"https://api.github.com/users/ruby-china/orgs","repos_url":"https://api.github.com/users/ruby-china/repos","events_url":"https://api.github.com/users/ruby-china/events{/privacy}","received_events_url":"https://api.github.com/users/ruby-china/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ruby-china/ruby-china","description":":circus_tent: Ruby China website source code.","fork":true,"url":"https://api.github.com/repos/ruby-china/ruby-china","forks_url":"https://api.github.com/repos/ruby-china/ruby-china/forks","keys_url":"https://api.github.com/repos/ruby-china/ruby-china/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ruby-china/ruby-china/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ruby-china/ruby-china/teams","hooks_url":"https://api.github.com/repos/ruby-china/ruby-china/hooks","issue_events_url":"https://api.github.com/repos/ruby-china/ruby-china/issues/events{/number}","events_url":"https://api.github.com/repos/ruby-china/ruby-china/events","assignees_url":"https://api.github.com/repos/ruby-china/ruby-china/assignees{/user}","branches_url":"https://api.github.com/repos/ruby-china/ruby-china/branches{/branch}","tags_url":"https://api.github.com/repos/ruby-china/ruby-china/tags","blobs_url":"https://api.github.com/repos/ruby-china/ruby-china/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ruby-china/ruby-china/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ruby-china/ruby-china/git/refs{/sha}","trees_url":"https://api.github.com/repos/ruby-china/ruby-china/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ruby-china/ruby-china/statuses/{sha}","languages_url":"https://api.github.com/repos/ruby-china/ruby-china/languages","stargazers_url":"https://api.github.com/repos/ruby-china/ruby-china/stargazers","contributors_url":"https://api.github.com/repos/ruby-china/ruby-china/contributors","subscribers_url":"https://api.github.com/repos/ruby-china/ruby-china/subscribers","subscription_url":"https://api.github.com/repos/ruby-china/ruby-china/subscription","commits_url":"https://api.github.com/repos/ruby-china/ruby-china/commits{/sha}","git_commits_url":"https://api.github.com/repos/ruby-china/ruby-china/git/commits{/sha}","comments_url":"https://api.github.com/repos/ruby-china/ruby-china/comments{/number}","issue_comment_url":"https://api.github.com/repos/ruby-china/ruby-china/issues/comments{/number}","contents_url":"https://api.github.com/repos/ruby-china/ruby-china/contents/{+path}","compare_url":"https://api.github.com/repos/ruby-china/ruby-china/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ruby-china/ruby-china/merges","archive_url":"https://api.github.com/repos/ruby-china/ruby-china/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ruby-china/ruby-china/downloads","issues_url":"https://api.github.com/repos/ruby-china/ruby-china/issues{/number}","pulls_url":"https://api.github.com/repos/ruby-china/ruby-china/pulls{/number}","milestones_url":"https://api.github.com/repos/ruby-china/ruby-china/milestones{/number}","notifications_url":"https://api.github.com/repos/ruby-china/ruby-china/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ruby-china/ruby-china/labels{/name}","releases_url":"https://api.github.com/repos/ruby-china/ruby-china/releases{/id}","deployments_url":"https://api.github.com/repos/ruby-china/ruby-china/deployments","created_at":"2012-03-27T10:26:23Z","updated_at":"2016-01-22T03:40:28Z","pushed_at":"2016-01-22T04:09:24Z","git_url":"git://github.com/ruby-china/ruby-china.git","ssh_url":"git@github.com:ruby-china/ruby-china.git","clone_url":"https://github.com/ruby-china/ruby-china.git","svn_url":"https://github.com/ruby-china/ruby-china","homepage":"http://ruby-china.org","size":25363,"stargazers_count":1714,"watchers_count":1714,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":778,"mirror_url":null,"open_issues_count":37,"forks":778,"open_issues":37,"watchers":1714,"default_branch":"master"}},"base":{"label":"ruby-china:master","ref":"master","sha":"e743374731fee0a394d92d77b9e0cf13aa1b94e9","user":{"login":"ruby-china","id":1331033,"avatar_url":"https://avatars.githubusercontent.com/u/1331033?v=3","gravatar_id":"","url":"https://api.github.com/users/ruby-china","html_url":"https://github.com/ruby-china","followers_url":"https://api.github.com/users/ruby-china/followers","following_url":"https://api.github.com/users/ruby-china/following{/other_user}","gists_url":"https://api.github.com/users/ruby-china/gists{/gist_id}","starred_url":"https://api.github.com/users/ruby-china/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruby-china/subscriptions","organizations_url":"https://api.github.com/users/ruby-china/orgs","repos_url":"https://api.github.com/users/ruby-china/repos","events_url":"https://api.github.com/users/ruby-china/events{/privacy}","received_events_url":"https://api.github.com/users/ruby-china/received_events","type":"Organization","site_admin":false},"repo":{"id":3842593,"name":"ruby-china","full_name":"ruby-china/ruby-china","owner":{"login":"ruby-china","id":1331033,"avatar_url":"https://avatars.githubusercontent.com/u/1331033?v=3","gravatar_id":"","url":"https://api.github.com/users/ruby-china","html_url":"https://github.com/ruby-china","followers_url":"https://api.github.com/users/ruby-china/followers","following_url":"https://api.github.com/users/ruby-china/following{/other_user}","gists_url":"https://api.github.com/users/ruby-china/gists{/gist_id}","starred_url":"https://api.github.com/users/ruby-china/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruby-china/subscriptions","organizations_url":"https://api.github.com/users/ruby-china/orgs","repos_url":"https://api.github.com/users/ruby-china/repos","events_url":"https://api.github.com/users/ruby-china/events{/privacy}","received_events_url":"https://api.github.com/users/ruby-china/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ruby-china/ruby-china","description":":circus_tent: Ruby China website source code.","fork":true,"url":"https://api.github.com/repos/ruby-china/ruby-china","forks_url":"https://api.github.com/repos/ruby-china/ruby-china/forks","keys_url":"https://api.github.com/repos/ruby-china/ruby-china/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ruby-china/ruby-china/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ruby-china/ruby-china/teams","hooks_url":"https://api.github.com/repos/ruby-china/ruby-china/hooks","issue_events_url":"https://api.github.com/repos/ruby-china/ruby-china/issues/events{/number}","events_url":"https://api.github.com/repos/ruby-china/ruby-china/events","assignees_url":"https://api.github.com/repos/ruby-china/ruby-china/assignees{/user}","branches_url":"https://api.github.com/repos/ruby-china/ruby-china/branches{/branch}","tags_url":"https://api.github.com/repos/ruby-china/ruby-china/tags","blobs_url":"https://api.github.com/repos/ruby-china/ruby-china/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ruby-china/ruby-china/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ruby-china/ruby-china/git/refs{/sha}","trees_url":"https://api.github.com/repos/ruby-china/ruby-china/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ruby-china/ruby-china/statuses/{sha}","languages_url":"https://api.github.com/repos/ruby-china/ruby-china/languages","stargazers_url":"https://api.github.com/repos/ruby-china/ruby-china/stargazers","contributors_url":"https://api.github.com/repos/ruby-china/ruby-china/contributors","subscribers_url":"https://api.github.com/repos/ruby-china/ruby-china/subscribers","subscription_url":"https://api.github.com/repos/ruby-china/ruby-china/subscription","commits_url":"https://api.github.com/repos/ruby-china/ruby-china/commits{/sha}","git_commits_url":"https://api.github.com/repos/ruby-china/ruby-china/git/commits{/sha}","comments_url":"https://api.github.com/repos/ruby-china/ruby-china/comments{/number}","issue_comment_url":"https://api.github.com/repos/ruby-china/ruby-china/issues/comments{/number}","contents_url":"https://api.github.com/repos/ruby-china/ruby-china/contents/{+path}","compare_url":"https://api.github.com/repos/ruby-china/ruby-china/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ruby-china/ruby-china/merges","archive_url":"https://api.github.com/repos/ruby-china/ruby-china/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ruby-china/ruby-china/downloads","issues_url":"https://api.github.com/repos/ruby-china/ruby-china/issues{/number}","pulls_url":"https://api.github.com/repos/ruby-china/ruby-china/pulls{/number}","milestones_url":"https://api.github.com/repos/ruby-china/ruby-china/milestones{/number}","notifications_url":"https://api.github.com/repos/ruby-china/ruby-china/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ruby-china/ruby-china/labels{/name}","releases_url":"https://api.github.com/repos/ruby-china/ruby-china/releases{/id}","deployments_url":"https://api.github.com/repos/ruby-china/ruby-china/deployments","created_at":"2012-03-27T10:26:23Z","updated_at":"2016-01-22T03:40:28Z","pushed_at":"2016-01-22T04:09:24Z","git_url":"git://github.com/ruby-china/ruby-china.git","ssh_url":"git@github.com:ruby-china/ruby-china.git","clone_url":"https://github.com/ruby-china/ruby-china.git","svn_url":"https://github.com/ruby-china/ruby-china","homepage":"http://ruby-china.org","size":25363,"stargazers_count":1714,"watchers_count":1714,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":778,"mirror_url":null,"open_issues_count":37,"forks":778,"open_issues":37,"watchers":1714,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ruby-china/ruby-china/pulls/539"},"html":{"href":"https://github.com/ruby-china/ruby-china/pull/539"},"issue":{"href":"https://api.github.com/repos/ruby-china/ruby-china/issues/539"},"comments":{"href":"https://api.github.com/repos/ruby-china/ruby-china/issues/539/comments"},"review_comments":{"href":"https://api.github.com/repos/ruby-china/ruby-china/pulls/539/comments"},"review_comment":{"href":"https://api.github.com/repos/ruby-china/ruby-china/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ruby-china/ruby-china/pulls/539/commits"},"statuses":{"href":"https://api.github.com/repos/ruby-china/ruby-china/statuses/c838f867f041514a774db5f3cf2924b635b3d0e9"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"huacnlee","id":5518,"avatar_url":"https://avatars.githubusercontent.com/u/5518?v=3","gravatar_id":"","url":"https://api.github.com/users/huacnlee","html_url":"https://github.com/huacnlee","followers_url":"https://api.github.com/users/huacnlee/followers","following_url":"https://api.github.com/users/huacnlee/following{/other_user}","gists_url":"https://api.github.com/users/huacnlee/gists{/gist_id}","starred_url":"https://api.github.com/users/huacnlee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huacnlee/subscriptions","organizations_url":"https://api.github.com/users/huacnlee/orgs","repos_url":"https://api.github.com/users/huacnlee/repos","events_url":"https://api.github.com/users/huacnlee/events{/privacy}","received_events_url":"https://api.github.com/users/huacnlee/received_events","type":"User","site_admin":false},"comments":6,"review_comments":0,"commits":33,"additions":1358,"deletions":1465,"changed_files":101}}