Removing a Column

Active Record caches database columns at runtime, so when we drop a column, it will cause exceptions until app reboots.

So we should first tell Active Record to ignore the column from cache:

class Events < ApplicationRecord
  self.ignored_columns = ["payload"]
end

And make sure there is no usage of event.payload.

Deploy.

Then write a migration to remove the column:

class RemoveSomeColumnFromUsers < ActiveRecord::Migration[7.0]
  def change
    remove_column :events, :payload
  end
end