{"action":"created","comment":{"url":"https://api.github.com/repos/yiisoft/yii2/pulls/comments/40502187","id":40502187,"diff_hunk":"@@ -22,6 +22,16 @@ class Schema extends \\yii\\db\\Schema\n      */\n     public $defaultSchema = 'dbo';\n     /**\n+     * @var array map of DB errors and corresponding exceptions\n+     * If left part is found in DB error message exception class from the right part is used.\n+     */\n+    public $exceptionMap = [\n+        'SQLSTATE[23' => 'yii\\db\\IntegrityException',\n+        'SQLSTATE[HY000]: General error: 20018 The INSERT statement conflicted with the FOREIGN KEY constraint' => 'yii\\db\\IntegrityException',","path":"framework/db/mssql/Schema.php","position":9,"original_position":9,"commit_id":"88bad426813011ae79086f13e20087d51027f710","original_commit_id":"88bad426813011ae79086f13e20087d51027f710","user":{"login":"samdark","id":47294,"avatar_url":"https://avatars.githubusercontent.com/u/47294?v=3","gravatar_id":"","url":"https://api.github.com/users/samdark","html_url":"https://github.com/samdark","followers_url":"https://api.github.com/users/samdark/followers","following_url":"https://api.github.com/users/samdark/following{/other_user}","gists_url":"https://api.github.com/users/samdark/gists{/gist_id}","starred_url":"https://api.github.com/users/samdark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samdark/subscriptions","organizations_url":"https://api.github.com/users/samdark/orgs","repos_url":"https://api.github.com/users/samdark/repos","events_url":"https://api.github.com/users/samdark/events{/privacy}","received_events_url":"https://api.github.com/users/samdark/received_events","type":"User","site_admin":false},"body":"Are all 20018 integrity violations?","created_at":"2015-09-27T07:02:34Z","updated_at":"2015-09-27T07:02:34Z","html_url":"https://github.com/yiisoft/yii2/pull/9773#discussion_r40502187","pull_request_url":"https://api.github.com/repos/yiisoft/yii2/pulls/9773","_links":{"self":{"href":"https://api.github.com/repos/yiisoft/yii2/pulls/comments/40502187"},"html":{"href":"https://github.com/yiisoft/yii2/pull/9773#discussion_r40502187"},"pull_request":{"href":"https://api.github.com/repos/yiisoft/yii2/pulls/9773"}}},"pull_request":{"url":"https://api.github.com/repos/yiisoft/yii2/pulls/9773","id":46092401,"html_url":"https://github.com/yiisoft/yii2/pull/9773","diff_url":"https://github.com/yiisoft/yii2/pull/9773.diff","patch_url":"https://github.com/yiisoft/yii2/pull/9773.patch","issue_url":"https://api.github.com/repos/yiisoft/yii2/issues/9773","number":9773,"state":"open","locked":false,"title":"Improve detecting default column values","user":{"login":"nineinchnick","id":795177,"avatar_url":"https://avatars.githubusercontent.com/u/795177?v=3","gravatar_id":"","url":"https://api.github.com/users/nineinchnick","html_url":"https://github.com/nineinchnick","followers_url":"https://api.github.com/users/nineinchnick/followers","following_url":"https://api.github.com/users/nineinchnick/following{/other_user}","gists_url":"https://api.github.com/users/nineinchnick/gists{/gist_id}","starred_url":"https://api.github.com/users/nineinchnick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nineinchnick/subscriptions","organizations_url":"https://api.github.com/users/nineinchnick/orgs","repos_url":"https://api.github.com/users/nineinchnick/repos","events_url":"https://api.github.com/users/nineinchnick/events{/privacy}","received_events_url":"https://api.github.com/users/nineinchnick/received_events","type":"User","site_admin":false},"body":"Resolves #7843 and #9759.\r\n\r\nThe main idea is to detect string and numeric literals in default values and wrap anything else in `\\yii\\db\\Expression`.\r\n\r\nThis has been implemented for Oracle, MSSQL, PostgreSQL and SQLite but is impossible in MySQL and maybe Cubrid.\r\n\r\nAlso, the condition to skip default values for primary keys has been dropped as it doesn't make sense.\r\n\r\nA new argument has been added to `\\yii\\db\\ActiveRecord::loadDefaultValues` to allow to ignore expressions, which would probably brake html forms without any extra conditions.\r\n\r\nFix lots of outdated MSSQL unit tests and added detecting integrity violation.\r\n\r\nReferences:\r\n\r\n* http://docs.oracle.com/cd/B19306_01/server.102/b14200/sql_elements003.htm\r\n* https://msdn.microsoft.com/en-us/library/ms179899.aspx\r\n* http://www.postgresql.org/docs/9.1/static/sql-syntax-lexical.html\r\n* https://www.sqlite.org/lang_expr.html","created_at":"2015-09-27T00:20:53Z","updated_at":"2015-09-27T07:02:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7701bdf5ce12c225a6528308a2b078096c427714","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/yiisoft/yii2/pulls/9773/commits","review_comments_url":"https://api.github.com/repos/yiisoft/yii2/pulls/9773/comments","review_comment_url":"https://api.github.com/repos/yiisoft/yii2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yiisoft/yii2/issues/9773/comments","statuses_url":"https://api.github.com/repos/yiisoft/yii2/statuses/88bad426813011ae79086f13e20087d51027f710","head":{"label":"nineinchnick:7843-default-column-values","ref":"7843-default-column-values","sha":"88bad426813011ae79086f13e20087d51027f710","user":{"login":"nineinchnick","id":795177,"avatar_url":"https://avatars.githubusercontent.com/u/795177?v=3","gravatar_id":"","url":"https://api.github.com/users/nineinchnick","html_url":"https://github.com/nineinchnick","followers_url":"https://api.github.com/users/nineinchnick/followers","following_url":"https://api.github.com/users/nineinchnick/following{/other_user}","gists_url":"https://api.github.com/users/nineinchnick/gists{/gist_id}","starred_url":"https://api.github.com/users/nineinchnick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nineinchnick/subscriptions","organizations_url":"https://api.github.com/users/nineinchnick/orgs","repos_url":"https://api.github.com/users/nineinchnick/repos","events_url":"https://api.github.com/users/nineinchnick/events{/privacy}","received_events_url":"https://api.github.com/users/nineinchnick/received_events","type":"User","site_admin":false},"repo":{"id":14659461,"name":"yii2","full_name":"nineinchnick/yii2","owner":{"login":"nineinchnick","id":795177,"avatar_url":"https://avatars.githubusercontent.com/u/795177?v=3","gravatar_id":"","url":"https://api.github.com/users/nineinchnick","html_url":"https://github.com/nineinchnick","followers_url":"https://api.github.com/users/nineinchnick/followers","following_url":"https://api.github.com/users/nineinchnick/following{/other_user}","gists_url":"https://api.github.com/users/nineinchnick/gists{/gist_id}","starred_url":"https://api.github.com/users/nineinchnick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nineinchnick/subscriptions","organizations_url":"https://api.github.com/users/nineinchnick/orgs","repos_url":"https://api.github.com/users/nineinchnick/repos","events_url":"https://api.github.com/users/nineinchnick/events{/privacy}","received_events_url":"https://api.github.com/users/nineinchnick/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nineinchnick/yii2","description":"Yii 2 framework main development repo","fork":true,"url":"https://api.github.com/repos/nineinchnick/yii2","forks_url":"https://api.github.com/repos/nineinchnick/yii2/forks","keys_url":"https://api.github.com/repos/nineinchnick/yii2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nineinchnick/yii2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nineinchnick/yii2/teams","hooks_url":"https://api.github.com/repos/nineinchnick/yii2/hooks","issue_events_url":"https://api.github.com/repos/nineinchnick/yii2/issues/events{/number}","events_url":"https://api.github.com/repos/nineinchnick/yii2/events","assignees_url":"https://api.github.com/repos/nineinchnick/yii2/assignees{/user}","branches_url":"https://api.github.com/repos/nineinchnick/yii2/branches{/branch}","tags_url":"https://api.github.com/repos/nineinchnick/yii2/tags","blobs_url":"https://api.github.com/repos/nineinchnick/yii2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nineinchnick/yii2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nineinchnick/yii2/git/refs{/sha}","trees_url":"https://api.github.com/repos/nineinchnick/yii2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nineinchnick/yii2/statuses/{sha}","languages_url":"https://api.github.com/repos/nineinchnick/yii2/languages","stargazers_url":"https://api.github.com/repos/nineinchnick/yii2/stargazers","contributors_url":"https://api.github.com/repos/nineinchnick/yii2/contributors","subscribers_url":"https://api.github.com/repos/nineinchnick/yii2/subscribers","subscription_url":"https://api.github.com/repos/nineinchnick/yii2/subscription","commits_url":"https://api.github.com/repos/nineinchnick/yii2/commits{/sha}","git_commits_url":"https://api.github.com/repos/nineinchnick/yii2/git/commits{/sha}","comments_url":"https://api.github.com/repos/nineinchnick/yii2/comments{/number}","issue_comment_url":"https://api.github.com/repos/nineinchnick/yii2/issues/comments{/number}","contents_url":"https://api.github.com/repos/nineinchnick/yii2/contents/{+path}","compare_url":"https://api.github.com/repos/nineinchnick/yii2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nineinchnick/yii2/merges","archive_url":"https://api.github.com/repos/nineinchnick/yii2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nineinchnick/yii2/downloads","issues_url":"https://api.github.com/repos/nineinchnick/yii2/issues{/number}","pulls_url":"https://api.github.com/repos/nineinchnick/yii2/pulls{/number}","milestones_url":"https://api.github.com/repos/nineinchnick/yii2/milestones{/number}","notifications_url":"https://api.github.com/repos/nineinchnick/yii2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nineinchnick/yii2/labels{/name}","releases_url":"https://api.github.com/repos/nineinchnick/yii2/releases{/id}","created_at":"2013-11-24T10:37:11Z","updated_at":"2015-05-08T08:20:43Z","pushed_at":"2015-09-27T02:56:17Z","git_url":"git://github.com/nineinchnick/yii2.git","ssh_url":"git@github.com:nineinchnick/yii2.git","clone_url":"https://github.com/nineinchnick/yii2.git","svn_url":"https://github.com/nineinchnick/yii2","homepage":"http://www.yiiframework.com","size":36516,"stargazers_count":0,"watchers_count":0,"language":"PHP","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":"yiisoft:master","ref":"master","sha":"760a1642380b5231b8f32fa8f0a64dcf307ac58a","user":{"login":"yiisoft","id":993323,"avatar_url":"https://avatars.githubusercontent.com/u/993323?v=3","gravatar_id":"","url":"https://api.github.com/users/yiisoft","html_url":"https://github.com/yiisoft","followers_url":"https://api.github.com/users/yiisoft/followers","following_url":"https://api.github.com/users/yiisoft/following{/other_user}","gists_url":"https://api.github.com/users/yiisoft/gists{/gist_id}","starred_url":"https://api.github.com/users/yiisoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yiisoft/subscriptions","organizations_url":"https://api.github.com/users/yiisoft/orgs","repos_url":"https://api.github.com/users/yiisoft/repos","events_url":"https://api.github.com/users/yiisoft/events{/privacy}","received_events_url":"https://api.github.com/users/yiisoft/received_events","type":"Organization","site_admin":false},"repo":{"id":3431193,"name":"yii2","full_name":"yiisoft/yii2","owner":{"login":"yiisoft","id":993323,"avatar_url":"https://avatars.githubusercontent.com/u/993323?v=3","gravatar_id":"","url":"https://api.github.com/users/yiisoft","html_url":"https://github.com/yiisoft","followers_url":"https://api.github.com/users/yiisoft/followers","following_url":"https://api.github.com/users/yiisoft/following{/other_user}","gists_url":"https://api.github.com/users/yiisoft/gists{/gist_id}","starred_url":"https://api.github.com/users/yiisoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yiisoft/subscriptions","organizations_url":"https://api.github.com/users/yiisoft/orgs","repos_url":"https://api.github.com/users/yiisoft/repos","events_url":"https://api.github.com/users/yiisoft/events{/privacy}","received_events_url":"https://api.github.com/users/yiisoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yiisoft/yii2","description":"Yii 2 framework main development repo","fork":false,"url":"https://api.github.com/repos/yiisoft/yii2","forks_url":"https://api.github.com/repos/yiisoft/yii2/forks","keys_url":"https://api.github.com/repos/yiisoft/yii2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yiisoft/yii2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yiisoft/yii2/teams","hooks_url":"https://api.github.com/repos/yiisoft/yii2/hooks","issue_events_url":"https://api.github.com/repos/yiisoft/yii2/issues/events{/number}","events_url":"https://api.github.com/repos/yiisoft/yii2/events","assignees_url":"https://api.github.com/repos/yiisoft/yii2/assignees{/user}","branches_url":"https://api.github.com/repos/yiisoft/yii2/branches{/branch}","tags_url":"https://api.github.com/repos/yiisoft/yii2/tags","blobs_url":"https://api.github.com/repos/yiisoft/yii2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yiisoft/yii2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yiisoft/yii2/git/refs{/sha}","trees_url":"https://api.github.com/repos/yiisoft/yii2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yiisoft/yii2/statuses/{sha}","languages_url":"https://api.github.com/repos/yiisoft/yii2/languages","stargazers_url":"https://api.github.com/repos/yiisoft/yii2/stargazers","contributors_url":"https://api.github.com/repos/yiisoft/yii2/contributors","subscribers_url":"https://api.github.com/repos/yiisoft/yii2/subscribers","subscription_url":"https://api.github.com/repos/yiisoft/yii2/subscription","commits_url":"https://api.github.com/repos/yiisoft/yii2/commits{/sha}","git_commits_url":"https://api.github.com/repos/yiisoft/yii2/git/commits{/sha}","comments_url":"https://api.github.com/repos/yiisoft/yii2/comments{/number}","issue_comment_url":"https://api.github.com/repos/yiisoft/yii2/issues/comments{/number}","contents_url":"https://api.github.com/repos/yiisoft/yii2/contents/{+path}","compare_url":"https://api.github.com/repos/yiisoft/yii2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yiisoft/yii2/merges","archive_url":"https://api.github.com/repos/yiisoft/yii2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yiisoft/yii2/downloads","issues_url":"https://api.github.com/repos/yiisoft/yii2/issues{/number}","pulls_url":"https://api.github.com/repos/yiisoft/yii2/pulls{/number}","milestones_url":"https://api.github.com/repos/yiisoft/yii2/milestones{/number}","notifications_url":"https://api.github.com/repos/yiisoft/yii2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yiisoft/yii2/labels{/name}","releases_url":"https://api.github.com/repos/yiisoft/yii2/releases{/id}","created_at":"2012-02-13T15:32:36Z","updated_at":"2015-09-26T22:39:32Z","pushed_at":"2015-09-27T02:56:18Z","git_url":"git://github.com/yiisoft/yii2.git","ssh_url":"git@github.com:yiisoft/yii2.git","clone_url":"https://github.com/yiisoft/yii2.git","svn_url":"https://github.com/yiisoft/yii2","homepage":"http://www.yiiframework.com","size":93570,"stargazers_count":6704,"watchers_count":6704,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3890,"mirror_url":null,"open_issues_count":1064,"forks":3890,"open_issues":1064,"watchers":6704,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yiisoft/yii2/pulls/9773"},"html":{"href":"https://github.com/yiisoft/yii2/pull/9773"},"issue":{"href":"https://api.github.com/repos/yiisoft/yii2/issues/9773"},"comments":{"href":"https://api.github.com/repos/yiisoft/yii2/issues/9773/comments"},"review_comments":{"href":"https://api.github.com/repos/yiisoft/yii2/pulls/9773/comments"},"review_comment":{"href":"https://api.github.com/repos/yiisoft/yii2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yiisoft/yii2/pulls/9773/commits"},"statuses":{"href":"https://api.github.com/repos/yiisoft/yii2/statuses/88bad426813011ae79086f13e20087d51027f710"}}}}