diff options
author | Gareth Rees <gareth@mysociety.org> | 2014-06-02 12:05:29 +0100 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2014-06-02 12:05:29 +0100 |
commit | 80b9cf720f6409773b2e6cf375b1239387da8ffa (patch) | |
tree | c5db411f4ce203cdcb82be6d147ac0af9104cbaa | |
parent | 47329b3c576fe73a6af0b84203ebc6b05cf2291d (diff) | |
parent | d31e0ffe49ea20a5bffc73751e9539fd0b431e95 (diff) |
Merge branch 'issues/476-track-things-index' into rails-3-develop
-rw-r--r-- | db/migrate/20140528110536_update_track_things_index.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/db/migrate/20140528110536_update_track_things_index.rb b/db/migrate/20140528110536_update_track_things_index.rb new file mode 100644 index 000000000..55ee0b70b --- /dev/null +++ b/db/migrate/20140528110536_update_track_things_index.rb @@ -0,0 +1,17 @@ +class UpdateTrackThingsIndex < ActiveRecord::Migration + + def up + if ActiveRecord::Base.connection.adapter_name == "PostgreSQL" + execute "ALTER TABLE track_things_sent_emails DROP CONSTRAINT fk_track_request_public_body" + execute "ALTER TABLE track_things_sent_emails ADD CONSTRAINT fk_track_request_public_body FOREIGN KEY (public_body_id) REFERENCES public_bodies(id)" + end + end + + def down + if ActiveRecord::Base.connection.adapter_name == "PostgreSQL" + execute "ALTER TABLE track_things_sent_emails DROP CONSTRAINT fk_track_request_public_body" + execute "ALTER TABLE track_things_sent_emails ADD CONSTRAINT fk_track_request_public_body FOREIGN KEY (user_id) REFERENCES users(id)" + end + end + +end |