{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/24300","repository_url":"https://api.github.com/repos/rails/rails","labels_url":"https://api.github.com/repos/rails/rails/issues/24300/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/24300/comments","events_url":"https://api.github.com/repos/rails/rails/issues/24300/events","html_url":"https://github.com/rails/rails/pull/24300","id":143267098,"number":24300,"title":"Reload all AR caches after migrations","user":{"login":"chrisarcand","id":2430490,"avatar_url":"https://avatars.githubusercontent.com/u/2430490?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisarcand","html_url":"https://github.com/chrisarcand","followers_url":"https://api.github.com/users/chrisarcand/followers","following_url":"https://api.github.com/users/chrisarcand/following{/other_user}","gists_url":"https://api.github.com/users/chrisarcand/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisarcand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisarcand/subscriptions","organizations_url":"https://api.github.com/users/chrisarcand/orgs","repos_url":"https://api.github.com/users/chrisarcand/repos","events_url":"https://api.github.com/users/chrisarcand/events{/privacy}","received_events_url":"https://api.github.com/users/chrisarcand/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rails/rails/labels/activerecord","name":"activerecord","color":"0b02e1"}],"state":"open","locked":false,"assignee":{"login":"rafaelfranca","id":47848,"avatar_url":"https://avatars.githubusercontent.com/u/47848?v=3","gravatar_id":"","url":"https://api.github.com/users/rafaelfranca","html_url":"https://github.com/rafaelfranca","followers_url":"https://api.github.com/users/rafaelfranca/followers","following_url":"https://api.github.com/users/rafaelfranca/following{/other_user}","gists_url":"https://api.github.com/users/rafaelfranca/gists{/gist_id}","starred_url":"https://api.github.com/users/rafaelfranca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rafaelfranca/subscriptions","organizations_url":"https://api.github.com/users/rafaelfranca/orgs","repos_url":"https://api.github.com/users/rafaelfranca/repos","events_url":"https://api.github.com/users/rafaelfranca/events{/privacy}","received_events_url":"https://api.github.com/users/rafaelfranca/received_events","type":"User","site_admin":false},"milestone":null,"comments":5,"created_at":"2016-03-24T14:50:41Z","updated_at":"2016-03-24T17:21:48Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rails/rails/pulls/24300","html_url":"https://github.com/rails/rails/pull/24300","diff_url":"https://github.com/rails/rails/pull/24300.diff","patch_url":"https://github.com/rails/rails/pull/24300.patch"},"body":"### Summary\r\n\r\nFixes #24273, potentially\r\n\r\nThis PR does two things:\r\n\r\n* Changes `ActiveRecord::Base.clear_cache!` to _also_ clear model caches, which have drifted separately from the db adapter's schema cache. (See related Issue for an example of why that's bad. TLDR: clearing the schema cache does not clear columns on models)\r\n* With all caches being properly cleared, calls `clear_cache!` at the end of the `migrate` task. This removes the unfortunate fact that after migrations, seeding (in the same process) would now have models with inaccurate `columns` (be it from column removals, whatever). Related: https://github.com/ManageIQ/manageiq/pull/7476\r\n\r\n### Other information\r\n\r\n**Note: This PR is currently not mergeable as it breaks the test suite due to connection clearing where we are currently mocking a connection.** I was asked to open this PR early for more open discussion as changes progress. "},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/200935592","html_url":"https://github.com/rails/rails/pull/24300#issuecomment-200935592","issue_url":"https://api.github.com/repos/rails/rails/issues/24300","id":200935592,"user":{"login":"chrisarcand","id":2430490,"avatar_url":"https://avatars.githubusercontent.com/u/2430490?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisarcand","html_url":"https://github.com/chrisarcand","followers_url":"https://api.github.com/users/chrisarcand/followers","following_url":"https://api.github.com/users/chrisarcand/following{/other_user}","gists_url":"https://api.github.com/users/chrisarcand/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisarcand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisarcand/subscriptions","organizations_url":"https://api.github.com/users/chrisarcand/orgs","repos_url":"https://api.github.com/users/chrisarcand/repos","events_url":"https://api.github.com/users/chrisarcand/events{/privacy}","received_events_url":"https://api.github.com/users/chrisarcand/received_events","type":"User","site_admin":false},"created_at":"2016-03-24T17:21:48Z","updated_at":"2016-03-24T17:21:48Z","body":"I've decided I'd like to split this PR as it really solves two different things - and the latter one being discussed might need some more time and thought put in to it.\r\n\r\nI've moved the migrate task change to #24305 as `clear_cache!` should still be the entry point to clear caches (and coincidentally fixes our issue in ManageIQ immediately, I believe) and it leaves this one concentrated on the centralized caching issue."}}