Pat Maddox
2006-Apr-02 08:24 UTC
[Rails] not null constraints added when running rake - is this a "feature?"
After upgrading to Rails 1.1, a lot of my unit tests broke. Turns out when I run rake test_units and it migrates the test database, it adds a not null constraint to every column. I don''t have this specified in my migration, and apparently it works fine with rake migrate if I do ''rake migrate RAILS_ENV=test'', the not null constraints aren''t set. So why when I run tests is it adding the not null constraints? I''m using PostgreSQL 8.1.0, fwiw. Pat
John Dell
2006-Apr-03 04:16 UTC
[Rails] not null constraints added when running rake - is this a "feature?"
Pat Maddox wrote:> After upgrading to Rails 1.1, a lot of my unit tests broke. Turns out > when I run rake test_units and it migrates the test database, it adds > a not null constraint to every column. I don''t have this specified in > my migration, and apparently it works fine with rake migrate if I do > ''rake migrate RAILS_ENV=test'', the not null constraints aren''t set. > So why when I run tests is it adding the not null constraints? I''m > using PostgreSQL 8.1.0, fwiw.Hi Pat, I have this problem also. I only get it on Linux with postgres 8.1. using ruby-postgres. It works ok on Mac. Here is the ticket I opened on it. Please chime in on the ticket to help it get some traction with the devs: http://dev.rubyonrails.org/ticket/4478 In the ticket, one guy mentions trying just the postgres driver (not ruby-postgres), but that driver errors out for me. Thanks, John