When I added a new column to the table and checked it using Sequel Pro etc., I had the experience that the newly added column was displayed at the end and it was hard to see, so I tried to find out how to fix it.
If you add a column without specifying anything, the newly added column (total_price, is_cancel) will be placed after updated_at as shown in this figure.
class AddColumnToOrders < ActiveRecord::Migration[6.0] def change add_column :orders, :total_price, :integer, null: false, after: :user_id add_column :orders, :is_cancel, :boolean, null: false, default: 0, after: :total_price end end
In this way, you can use the after option to specify which column you want the newly added column to follow!
I was able to place a new column next to the user_id column.
Control the order of columns added by rails migration