{"action":"created","comment":{"url":"https://api.github.com/repos/DoSomething/gladiator/pulls/comments/57222249","id":57222249,"diff_hunk":"@@ -0,0 +1,35 @@\n+<?php\n+\n+use Illuminate\\Database\\Schema\\Blueprint;\n+use Illuminate\\Database\\Migrations\\Migration;\n+\n+class CreateMessagesTable extends Migration\n+{\n+    /**\n+     * Run the migrations.\n+     *\n+     * @return void\n+     */\n+    public function up()\n+    {\n+        Schema::create('messages', function (Blueprint $table) {\n+            $table->increments('id');\n+            $table->integer('contest_id')->unsigned()->index();\n+            $table->foreign('contest_id')->references('id')->on('contests')->onDelete('cascade');\n+            $table->string('type')->index();\n+            $table->subject('subject')->nullable();","path":"database/migrations/2016_03_23_175405_create_messages_table.php","position":20,"original_position":20,"commit_id":"9068b63ab47cd84a8802422ff80a6dbe0cb3e336","original_commit_id":"9068b63ab47cd84a8802422ff80a6dbe0cb3e336","user":{"login":"angaither","id":645205,"avatar_url":"https://avatars.githubusercontent.com/u/645205?v=3","gravatar_id":"","url":"https://api.github.com/users/angaither","html_url":"https://github.com/angaither","followers_url":"https://api.github.com/users/angaither/followers","following_url":"https://api.github.com/users/angaither/following{/other_user}","gists_url":"https://api.github.com/users/angaither/gists{/gist_id}","starred_url":"https://api.github.com/users/angaither/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angaither/subscriptions","organizations_url":"https://api.github.com/users/angaither/orgs","repos_url":"https://api.github.com/users/angaither/repos","events_url":"https://api.github.com/users/angaither/events{/privacy}","received_events_url":"https://api.github.com/users/angaither/received_events","type":"User","site_admin":false},"body":"`  $table->subject('subject')->nullable();` subject != a database type. `text` or `string`","created_at":"2016-03-23T19:29:19Z","updated_at":"2016-03-23T19:29:19Z","html_url":"https://github.com/DoSomething/gladiator/pull/135#discussion_r57222249","pull_request_url":"https://api.github.com/repos/DoSomething/gladiator/pulls/135","_links":{"self":{"href":"https://api.github.com/repos/DoSomething/gladiator/pulls/comments/57222249"},"html":{"href":"https://github.com/DoSomething/gladiator/pull/135#discussion_r57222249"},"pull_request":{"href":"https://api.github.com/repos/DoSomething/gladiator/pulls/135"}}},"pull_request":{"url":"https://api.github.com/repos/DoSomething/gladiator/pulls/135","id":63930192,"html_url":"https://github.com/DoSomething/gladiator/pull/135","diff_url":"https://github.com/DoSomething/gladiator/pull/135.diff","patch_url":"https://github.com/DoSomething/gladiator/pull/135.patch","issue_url":"https://api.github.com/repos/DoSomething/gladiator/issues/135","number":135,"state":"open","locked":false,"title":"Messages schema and model.","user":{"login":"weerd","id":105849,"avatar_url":"https://avatars.githubusercontent.com/u/105849?v=3","gravatar_id":"","url":"https://api.github.com/users/weerd","html_url":"https://github.com/weerd","followers_url":"https://api.github.com/users/weerd/followers","following_url":"https://api.github.com/users/weerd/following{/other_user}","gists_url":"https://api.github.com/users/weerd/gists{/gist_id}","starred_url":"https://api.github.com/users/weerd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weerd/subscriptions","organizations_url":"https://api.github.com/users/weerd/orgs","repos_url":"https://api.github.com/users/weerd/repos","events_url":"https://api.github.com/users/weerd/events{/privacy}","received_events_url":"https://api.github.com/users/weerd/received_events","type":"User","site_admin":false},"body":"#### What's this PR do?\r\nThis PR adds the migration for upcoming Messages work. It also adds a `Message` model and a helper function to extract the different message types when needed, and adds associated relationship method to the `Contest` model.\r\n\r\n#### How should this be manually tested?\r\nJust :eyes: the code. Nothing to test just yet! **Most importantly**, closely review the migration and make sure that all looks correct... should there be an `index()` on the `type`? I figured it'd be useful, but also not a MySQL :neckbeard: \r\n\r\n#### Any background context you want to provide?\r\nWe were initially thinking of using `enum` for the `type` column data type, but it could end up complicating things, especially when adding/removing different email types in the future and needing to do that all with costly migrations :scream_cat: \r\n\r\n#### What are the relevant tickets?\r\nFixes #130\r\n\r\n---\r\n@angaither @sbsmith86 @deadlybutter ","created_at":"2016-03-23T18:25:54Z","updated_at":"2016-03-23T19:29:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"16b6424f8e7c805f22f87af0f7d4f6069ee22a27","assignee":{"login":"angaither","id":645205,"avatar_url":"https://avatars.githubusercontent.com/u/645205?v=3","gravatar_id":"","url":"https://api.github.com/users/angaither","html_url":"https://github.com/angaither","followers_url":"https://api.github.com/users/angaither/followers","following_url":"https://api.github.com/users/angaither/following{/other_user}","gists_url":"https://api.github.com/users/angaither/gists{/gist_id}","starred_url":"https://api.github.com/users/angaither/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angaither/subscriptions","organizations_url":"https://api.github.com/users/angaither/orgs","repos_url":"https://api.github.com/users/angaither/repos","events_url":"https://api.github.com/users/angaither/events{/privacy}","received_events_url":"https://api.github.com/users/angaither/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/DoSomething/gladiator/pulls/135/commits","review_comments_url":"https://api.github.com/repos/DoSomething/gladiator/pulls/135/comments","review_comment_url":"https://api.github.com/repos/DoSomething/gladiator/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DoSomething/gladiator/issues/135/comments","statuses_url":"https://api.github.com/repos/DoSomething/gladiator/statuses/9068b63ab47cd84a8802422ff80a6dbe0cb3e336","head":{"label":"DoSomething:messaging-schema","ref":"messaging-schema","sha":"9068b63ab47cd84a8802422ff80a6dbe0cb3e336","user":{"login":"DoSomething","id":731685,"avatar_url":"https://avatars.githubusercontent.com/u/731685?v=3","gravatar_id":"","url":"https://api.github.com/users/DoSomething","html_url":"https://github.com/DoSomething","followers_url":"https://api.github.com/users/DoSomething/followers","following_url":"https://api.github.com/users/DoSomething/following{/other_user}","gists_url":"https://api.github.com/users/DoSomething/gists{/gist_id}","starred_url":"https://api.github.com/users/DoSomething/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DoSomething/subscriptions","organizations_url":"https://api.github.com/users/DoSomething/orgs","repos_url":"https://api.github.com/users/DoSomething/repos","events_url":"https://api.github.com/users/DoSomething/events{/privacy}","received_events_url":"https://api.github.com/users/DoSomething/received_events","type":"Organization","site_admin":false},"repo":{"id":51176505,"name":"gladiator","full_name":"DoSomething/gladiator","owner":{"login":"DoSomething","id":731685,"avatar_url":"https://avatars.githubusercontent.com/u/731685?v=3","gravatar_id":"","url":"https://api.github.com/users/DoSomething","html_url":"https://github.com/DoSomething","followers_url":"https://api.github.com/users/DoSomething/followers","following_url":"https://api.github.com/users/DoSomething/following{/other_user}","gists_url":"https://api.github.com/users/DoSomething/gists{/gist_id}","starred_url":"https://api.github.com/users/DoSomething/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DoSomething/subscriptions","organizations_url":"https://api.github.com/users/DoSomething/orgs","repos_url":"https://api.github.com/users/DoSomething/repos","events_url":"https://api.github.com/users/DoSomething/events{/privacy}","received_events_url":"https://api.github.com/users/DoSomething/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DoSomething/gladiator","description":"The DoSomething.org Competitions Platform","fork":false,"url":"https://api.github.com/repos/DoSomething/gladiator","forks_url":"https://api.github.com/repos/DoSomething/gladiator/forks","keys_url":"https://api.github.com/repos/DoSomething/gladiator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DoSomething/gladiator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DoSomething/gladiator/teams","hooks_url":"https://api.github.com/repos/DoSomething/gladiator/hooks","issue_events_url":"https://api.github.com/repos/DoSomething/gladiator/issues/events{/number}","events_url":"https://api.github.com/repos/DoSomething/gladiator/events","assignees_url":"https://api.github.com/repos/DoSomething/gladiator/assignees{/user}","branches_url":"https://api.github.com/repos/DoSomething/gladiator/branches{/branch}","tags_url":"https://api.github.com/repos/DoSomething/gladiator/tags","blobs_url":"https://api.github.com/repos/DoSomething/gladiator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DoSomething/gladiator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DoSomething/gladiator/git/refs{/sha}","trees_url":"https://api.github.com/repos/DoSomething/gladiator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DoSomething/gladiator/statuses/{sha}","languages_url":"https://api.github.com/repos/DoSomething/gladiator/languages","stargazers_url":"https://api.github.com/repos/DoSomething/gladiator/stargazers","contributors_url":"https://api.github.com/repos/DoSomething/gladiator/contributors","subscribers_url":"https://api.github.com/repos/DoSomething/gladiator/subscribers","subscription_url":"https://api.github.com/repos/DoSomething/gladiator/subscription","commits_url":"https://api.github.com/repos/DoSomething/gladiator/commits{/sha}","git_commits_url":"https://api.github.com/repos/DoSomething/gladiator/git/commits{/sha}","comments_url":"https://api.github.com/repos/DoSomething/gladiator/comments{/number}","issue_comment_url":"https://api.github.com/repos/DoSomething/gladiator/issues/comments{/number}","contents_url":"https://api.github.com/repos/DoSomething/gladiator/contents/{+path}","compare_url":"https://api.github.com/repos/DoSomething/gladiator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DoSomething/gladiator/merges","archive_url":"https://api.github.com/repos/DoSomething/gladiator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DoSomething/gladiator/downloads","issues_url":"https://api.github.com/repos/DoSomething/gladiator/issues{/number}","pulls_url":"https://api.github.com/repos/DoSomething/gladiator/pulls{/number}","milestones_url":"https://api.github.com/repos/DoSomething/gladiator/milestones{/number}","notifications_url":"https://api.github.com/repos/DoSomething/gladiator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DoSomething/gladiator/labels{/name}","releases_url":"https://api.github.com/repos/DoSomething/gladiator/releases{/id}","deployments_url":"https://api.github.com/repos/DoSomething/gladiator/deployments","created_at":"2016-02-05T21:53:32Z","updated_at":"2016-02-05T22:11:13Z","pushed_at":"2016-03-23T19:20:09Z","git_url":"git://github.com/DoSomething/gladiator.git","ssh_url":"git@github.com:DoSomething/gladiator.git","clone_url":"https://github.com/DoSomething/gladiator.git","svn_url":"https://github.com/DoSomething/gladiator","homepage":null,"size":393,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":11,"forks":0,"open_issues":11,"watchers":0,"default_branch":"master"}},"base":{"label":"DoSomething:master","ref":"master","sha":"ae4608066349cd09cf87a4f8fd275e635d87359e","user":{"login":"DoSomething","id":731685,"avatar_url":"https://avatars.githubusercontent.com/u/731685?v=3","gravatar_id":"","url":"https://api.github.com/users/DoSomething","html_url":"https://github.com/DoSomething","followers_url":"https://api.github.com/users/DoSomething/followers","following_url":"https://api.github.com/users/DoSomething/following{/other_user}","gists_url":"https://api.github.com/users/DoSomething/gists{/gist_id}","starred_url":"https://api.github.com/users/DoSomething/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DoSomething/subscriptions","organizations_url":"https://api.github.com/users/DoSomething/orgs","repos_url":"https://api.github.com/users/DoSomething/repos","events_url":"https://api.github.com/users/DoSomething/events{/privacy}","received_events_url":"https://api.github.com/users/DoSomething/received_events","type":"Organization","site_admin":false},"repo":{"id":51176505,"name":"gladiator","full_name":"DoSomething/gladiator","owner":{"login":"DoSomething","id":731685,"avatar_url":"https://avatars.githubusercontent.com/u/731685?v=3","gravatar_id":"","url":"https://api.github.com/users/DoSomething","html_url":"https://github.com/DoSomething","followers_url":"https://api.github.com/users/DoSomething/followers","following_url":"https://api.github.com/users/DoSomething/following{/other_user}","gists_url":"https://api.github.com/users/DoSomething/gists{/gist_id}","starred_url":"https://api.github.com/users/DoSomething/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DoSomething/subscriptions","organizations_url":"https://api.github.com/users/DoSomething/orgs","repos_url":"https://api.github.com/users/DoSomething/repos","events_url":"https://api.github.com/users/DoSomething/events{/privacy}","received_events_url":"https://api.github.com/users/DoSomething/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DoSomething/gladiator","description":"The DoSomething.org Competitions Platform","fork":false,"url":"https://api.github.com/repos/DoSomething/gladiator","forks_url":"https://api.github.com/repos/DoSomething/gladiator/forks","keys_url":"https://api.github.com/repos/DoSomething/gladiator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DoSomething/gladiator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DoSomething/gladiator/teams","hooks_url":"https://api.github.com/repos/DoSomething/gladiator/hooks","issue_events_url":"https://api.github.com/repos/DoSomething/gladiator/issues/events{/number}","events_url":"https://api.github.com/repos/DoSomething/gladiator/events","assignees_url":"https://api.github.com/repos/DoSomething/gladiator/assignees{/user}","branches_url":"https://api.github.com/repos/DoSomething/gladiator/branches{/branch}","tags_url":"https://api.github.com/repos/DoSomething/gladiator/tags","blobs_url":"https://api.github.com/repos/DoSomething/gladiator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DoSomething/gladiator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DoSomething/gladiator/git/refs{/sha}","trees_url":"https://api.github.com/repos/DoSomething/gladiator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DoSomething/gladiator/statuses/{sha}","languages_url":"https://api.github.com/repos/DoSomething/gladiator/languages","stargazers_url":"https://api.github.com/repos/DoSomething/gladiator/stargazers","contributors_url":"https://api.github.com/repos/DoSomething/gladiator/contributors","subscribers_url":"https://api.github.com/repos/DoSomething/gladiator/subscribers","subscription_url":"https://api.github.com/repos/DoSomething/gladiator/subscription","commits_url":"https://api.github.com/repos/DoSomething/gladiator/commits{/sha}","git_commits_url":"https://api.github.com/repos/DoSomething/gladiator/git/commits{/sha}","comments_url":"https://api.github.com/repos/DoSomething/gladiator/comments{/number}","issue_comment_url":"https://api.github.com/repos/DoSomething/gladiator/issues/comments{/number}","contents_url":"https://api.github.com/repos/DoSomething/gladiator/contents/{+path}","compare_url":"https://api.github.com/repos/DoSomething/gladiator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DoSomething/gladiator/merges","archive_url":"https://api.github.com/repos/DoSomething/gladiator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DoSomething/gladiator/downloads","issues_url":"https://api.github.com/repos/DoSomething/gladiator/issues{/number}","pulls_url":"https://api.github.com/repos/DoSomething/gladiator/pulls{/number}","milestones_url":"https://api.github.com/repos/DoSomething/gladiator/milestones{/number}","notifications_url":"https://api.github.com/repos/DoSomething/gladiator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DoSomething/gladiator/labels{/name}","releases_url":"https://api.github.com/repos/DoSomething/gladiator/releases{/id}","deployments_url":"https://api.github.com/repos/DoSomething/gladiator/deployments","created_at":"2016-02-05T21:53:32Z","updated_at":"2016-02-05T22:11:13Z","pushed_at":"2016-03-23T19:20:09Z","git_url":"git://github.com/DoSomething/gladiator.git","ssh_url":"git@github.com:DoSomething/gladiator.git","clone_url":"https://github.com/DoSomething/gladiator.git","svn_url":"https://github.com/DoSomething/gladiator","homepage":null,"size":393,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":11,"forks":0,"open_issues":11,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DoSomething/gladiator/pulls/135"},"html":{"href":"https://github.com/DoSomething/gladiator/pull/135"},"issue":{"href":"https://api.github.com/repos/DoSomething/gladiator/issues/135"},"comments":{"href":"https://api.github.com/repos/DoSomething/gladiator/issues/135/comments"},"review_comments":{"href":"https://api.github.com/repos/DoSomething/gladiator/pulls/135/comments"},"review_comment":{"href":"https://api.github.com/repos/DoSomething/gladiator/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DoSomething/gladiator/pulls/135/commits"},"statuses":{"href":"https://api.github.com/repos/DoSomething/gladiator/statuses/9068b63ab47cd84a8802422ff80a6dbe0cb3e336"}}}}