rails migration foreign key optional code example
Example 1: rails migration update column default value
class MigrationName < ActiveRecord::Migration
def change
change_column :my_table, :my_column, :data_type, deafult: "value"
end
end
Example 2: using SQL in rails migration
def change
execute <<-SQL
UPDATE table1
SET column1 = "value"
SQL
end