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

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -