When the unit test harness creates a test database from the
development database, the ON DELETE CASCADE constraints I have on my
foreign keys are not copied into the test database. (I can tell by
looking at db/development_structure.sql.)
That means the fixtures can’t load/unload from the test database
properly. In other words, all my tests fail with the same error
ActiveRecord::StatementInvalid: PGError: ERROR: update or delete on
“orders” violates foreign key constraint
“redeemed_coupons_order_id_fkey” on “redeemed_coupons”
DETAIL: Key (id)=(1) is still referenced from table “redeemed_coupons”.
Is this a bug or intended behavior? If it is intended behavior, then
what am I doing wrong?
Thanks for your help.
Jim M., email@example.com, firstname.lastname@example.org