나는이 다음 레일 마이그레이션 :MySQL 테이블에서 "NOT NULL"을 사용해야하는시기는 언제입니까?
create_table :articles do |t|
t.integer :user_id, :allow_null => false
t.integer :genre_id, :allow_null => false
t.string :url, :limit => 255, :allow_null => false
t.string :title, :limit => 60, :allow_null => false
t.text :summary, :limit => 350, :allow_null => false
t.integer :votes_count, :default => 0
t.datetime :published_at, :default => nil
t.timestamps
end
먼저 모델에서 검증 "NULL NOT"모든 필드를, 그래서 마이그레이션에 allow_null을 가지고 귀찮게해야하는 경우 궁금 해요? "NOT NULL"이 데이터베이스에 있으면 어떤 이점이 있는지 확실하지 않습니다.