# Not null constraints added when running rake - is this a "fe

**URL:** <https://www.ruby-forum.com/t/not-null-constraints-added-when-running-rake-is-this-a-fe/93416>\
**Category:** Rails\
**Created:** [April 2, 2006, 10:26am UTC](https://www.ruby-forum.com/t/not-null-constraints-added-when-running-rake-is-this-a-fe/93416 "2006-04-02T10:26:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pergesu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/22d042/32.png) [@pergesu](https://www.ruby-forum.com/u/pergesu)\
**Post date:** [April 2, 2006, 10:26am UTC](https://www.ruby-forum.com/t/not-null-constraints-added-when-running-rake-is-this-a-fe/93416/1 "2006-04-02T10:26:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pergesu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/22d042/32.png) [@pergesu](https://www.ruby-forum.com/u/pergesu)\
**Post date:** [April 3, 2006, 6:17am UTC](https://www.ruby-forum.com/t/not-null-constraints-added-when-running-rake-is-this-a-fe/93416/2 "2006-04-03T06:17:45Z")

</div>

Pat M. 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](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
