Skip to content

Loading…

Fixed test_disable_referential_integrity on Oracle #2466

Merged
merged 1 commit into from

2 participants

@rsim

On Oracle disable_referential_integrity before execution of block will disable foreign key constraints and after block will enable them but when constraints are enabled then they are validated. Therefore created record with invalid foreign key should be deleted before enabling foreign key constraints.

@rsim rsim Fixed test_disable_referential_integrity on Oracle
On Oracle disable_referential_integrity before execution of block will disable foreign key constraints and after block will enable them but when constraints are enabled then they are validated. Therefore created record with invalid foreign key should be deleted before enabling foreign key constraints.
58af0d4
@tenderlove tenderlove merged commit 11fbeb7 into rails:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 8, 2011
  1. @rsim

    Fixed test_disable_referential_integrity on Oracle

    rsim committed
    On Oracle disable_referential_integrity before execution of block will disable foreign key constraints and after block will enable them but when constraints are enabled then they are validated. Therefore created record with invalid foreign key should be deleted before enabling foreign key constraints.
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 0 deletions.
  1. +3 −0 activerecord/test/cases/adapter_test.rb
View
3 activerecord/test/cases/adapter_test.rb
@@ -151,6 +151,9 @@ def test_disable_referential_integrity
else
@connection.execute "INSERT INTO fk_test_has_fk (fk_id) VALUES (0)"
end
+ # should deleted created record as otherwise disable_referential_integrity will try to enable contraints after executed block
+ # and will fail (at least on Oracle)
+ @connection.execute "DELETE FROM fk_test_has_fk"
end
end
end
Something went wrong with that request. Please try again.