title: Rails 5.2 Error Changing or Removing Table Column (SQLite3::ConstraintException: FOREIGN KEY constraint failed: DROP TABLE)
body: <p>I'm trying to accomplish the fairly simple feat of changing the default value for one of the columns from my <code>Blog</code> table.  I have the following migration:</p>
  
  <pre><code>class UpdateBlogFields &lt; ActiveRecord::Migration[5.2]
    def change
      change_column :blogs, :freebie_type, :string, default: "None"
    end
  end
  </code></pre>
  
  <p>Fairly simple, but I'm getting the following error when I run <code>rake db:migrate</code>:</p>
  
  <pre><code>StandardError: An error has occurred, this and all later migrations canceled:
  SQLite3::ConstraintException: FOREIGN KEY constraint failed: DROP TABLE "blogs"
  </code></pre>
  
  <p>I get this error any time I try to change or remove a column, but not when adding one.</p>
  
  <p>My schema looks like this:</p>
  
  <pre><code>  create_table "blogs", force: :cascade do |t|
      t.string "title"
      t.string "teaser"
      t.text "body"
      t.string "category", default: "General"
      t.string "linked_module"
      t.boolean "published", default: false
      t.datetime "published_on"
      t.integer "user_id"
      t.integer "image_id"
      t.integer "pdf_id"
      t.datetime "created_at", null: false
      t.datetime "updated_at", null: false
      t.string "slug"
      t.string "cta_read_more", default: "Read More"
      t.string "cta_pdf", default: "Get My Free PDF"
      t.string "cta_video", default: "Watch the Video"
      t.string "convertkit_data_form_toggle"
      t.string "convertkit_href"
      t.integer "pin_image_id"
      t.string "data_pin_description"
      t.string "freebie_filename"
      t.string "video_link"
      t.string "freebie_type", default: "File"
      t.string "freebie_description"
      t.integer "comments_count"
      t.integer "subcategory_id"
      t.boolean "affiliate_links", default: true
      t.boolean "approved", default: false
      t.boolean "submitted", default: false
      t.index ["image_id"], name: "index_blogs_on_image_id"
      t.index ["pdf_id"], name: "index_blogs_on_pdf_id"
      t.index ["pin_image_id"], name: "index_blogs_on_pin_image_id"
      t.index ["slug"], name: "index_blogs_on_slug", unique: true
      t.index ["subcategory_id"], name: "index_blogs_on_subcategory_id"
      t.index ["user_id"], name: "index_blogs_on_user_id"
    end
  </code></pre>
  
  <p>It seems that this might be an SQLite thing, because <a href="https://stackoverflow.com/questions/47347421/error-removing-column-rails">this post</a> and <a href="https://stackoverflow.com/questions/53354868/why-does-rails-want-to-drop-a-table-just-to-rename-a-column-sqlite">this one</a> seem to be having a similar problem.  However, neither post involves an actual answer.  Has anyone successfully gotten rid of this?</p>