Insert a default value into migration

You are here:
Estimated reading time: < 1 min

-After running migration in the command line. Go to the migration file in db/[migration-file]

-insert default value using the following example

 

class AddConnectCodeToUsers < ActiveRecord::Migration[6.0]
def change
add_column :users, :connect_code, :integer, default: 0
end
end

Was this article helpful?
Dislike 0