{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/19522","labels_url":"https://api.github.com/repos/rails/rails/issues/19522/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/19522/comments","events_url":"https://api.github.com/repos/rails/rails/issues/19522/events","html_url":"https://github.com/rails/rails/issues/19522","id":64416174,"number":19522,"title":"rake db:migrate and db:rollback isn't affecting foreign keys relationships in the test db","user":{"login":"reconbot","id":25966,"avatar_url":"https://avatars.githubusercontent.com/u/25966?v=3","gravatar_id":"","url":"https://api.github.com/users/reconbot","html_url":"https://github.com/reconbot","followers_url":"https://api.github.com/users/reconbot/followers","following_url":"https://api.github.com/users/reconbot/following{/other_user}","gists_url":"https://api.github.com/users/reconbot/gists{/gist_id}","starred_url":"https://api.github.com/users/reconbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reconbot/subscriptions","organizations_url":"https://api.github.com/users/reconbot/orgs","repos_url":"https://api.github.com/users/reconbot/repos","events_url":"https://api.github.com/users/reconbot/events{/privacy}","received_events_url":"https://api.github.com/users/reconbot/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rails/rails/labels/docs","name":"docs","color":"02d7e1"},{"url":"https://api.github.com/repos/rails/rails/labels/needs%20feedback","name":"needs feedback","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-03-26T01:49:08Z","updated_at":"2015-04-01T16:30:30Z","closed_at":null,"body":"I've got a rails app that was recently updated to 4.2.1. We added some foreign key constraints in a migration and ran our tests.\r\n\r\n```ruby\r\nclass ImmigrationReform < ActiveRecord::Migration\r\n  def change\r\n    # in a migration\r\n    add_foreign_key 'order_items', 'orders', name: 'order_items_order_id_fk', on_delete: :cascade\r\n  end\r\nend\r\n```\r\n\r\nThen I run `rake db:migrate` and it modifies the dev database but not the test database (confirmed with psql). A `rake db:test:prepare` brings the test schema in line. I've confirmed the issue with both migrations and rollbacks."},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/88544554","html_url":"https://github.com/rails/rails/issues/19522#issuecomment-88544554","issue_url":"https://api.github.com/repos/rails/rails/issues/19522","id":88544554,"user":{"login":"reconbot","id":25966,"avatar_url":"https://avatars.githubusercontent.com/u/25966?v=3","gravatar_id":"","url":"https://api.github.com/users/reconbot","html_url":"https://github.com/reconbot","followers_url":"https://api.github.com/users/reconbot/followers","following_url":"https://api.github.com/users/reconbot/following{/other_user}","gists_url":"https://api.github.com/users/reconbot/gists{/gist_id}","starred_url":"https://api.github.com/users/reconbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reconbot/subscriptions","organizations_url":"https://api.github.com/users/reconbot/orgs","repos_url":"https://api.github.com/users/reconbot/repos","events_url":"https://api.github.com/users/reconbot/events{/privacy}","received_events_url":"https://api.github.com/users/reconbot/received_events","type":"User","site_admin":false},"created_at":"2015-04-01T16:30:30Z","updated_at":"2015-04-01T16:30:30Z","body":"Yes I did, they failed.\nOn Apr 1, 2015 12:01 PM, \"Yves Senn\" <notifications@github.com> wrote:\n\n> just making sure before I try to figure out whats going on. After you ran bin/rake\n> db:migrate you did execute some tests before inspecting the test db with\n> psql?\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/rails/rails/issues/19522#issuecomment-88533416>.\n>\n"}}