How to change a nullable column to not nullable in a Rails migration? -


i created date column in previous migration , set nullable. want change not nullable. how go doing assuming there null rows in database? i'm ok setting columns time.now if they're null.

if in migration this:

# make sure no null value exist mymodel.update_all({ date_column: time.now }, { date_column: nil })  # change column not allow null change_column :my_models, :date_column, :datetime, null: false 

Comments

Popular posts from this blog

haskell - Using filter on an item in a list? -

c# - When does PreApplicationStartMethod actually get triggered to run? -

tomcat6 - Exception when stopping container for a with Spring + Quartz + Tomcat web application -