<p>I have the following rails migration:</p>

<pre><code>create_table :articles do |t|
  t.integer :user_id, :allow_null =&gt; false
  t.integer :genre_id, :allow_null =&gt; false
  t.string :url, :limit =&gt; 255, :allow_null =&gt; false
  t.string :title, :limit =&gt; 60, :allow_null =&gt; false
  t.text :summary, :limit =&gt; 350, :allow_null =&gt; false
  t.integer :votes_count, :default =&gt; 0
  t.datetime :published_at, :default =&gt; nil
  t.timestamps
end
</code></pre>

<p>All the fields that are "NOT NULL" are validated in the model first, so I'm wondering if I need to bother having allow_null in the migration? I'm not sure what benefits "NOT NULL" gives to the database, if any.</p>

Not much if you mean in terms of performance or storage efficiency.  However, it's just good practice to push as many of your low-level constraints into the database layer.  For one thing, it guarantees that a subtle bug in Rails isn't going to lead to some randomly
```
NULL
```
data in a not-null field.  Likewise, if you ever run another app against the same database, it will be extremely helpful to have the constraints in a central place for maintenance and to avoid duplication.