Rails 4: Remove not null constraint from table column with migration?

rails-migrations, ruby-on-rails-4

Solution

From the docs:

  def up
    change_column_default :table_name, :status, 0
  end

  def down
    change_column_default :table_name, :status, nil
  end

Problem

Given the following `schema.rb`: ``` create_table "people", force: true do |t| t.string "name", null: false t.integer "age" t.integer "height" t.string "email" t.boolean "married", default: false t.text "bio" t.integer "fav_number" t.decimal "lucky_num", precision: 2, scale: 2 t.datetime "birthday" t.datetime "created_at" t.datetime "updated_at" end ``` I'd like to remove the `name` default value of `null: false`. I've tried running a separate migration with `change_column_default`, but that had no impact on `schema.rb`. Any suggestions?

Original source

Related problems