code_junkie

When should I be using “NOT NULL” in a MySQL table and are there any benefits?

Nov 11th, 2011
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. create_table :articles do |t|
  2. t.integer :user_id, :allow_null => false
  3. t.integer :genre_id, :allow_null => false
  4. t.string :url, :limit => 255, :allow_null => false
  5. t.string :title, :limit => 60, :allow_null => false
  6. t.text :summary, :limit => 350, :allow_null => false
  7. t.integer :votes_count, :default => 0
  8. t.datetime :published_at, :default => nil
  9. t.timestamps
  10. end
Add Comment
Please, Sign In to add comment