Answers for "rails migration foreign key optional"

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
Posted by: Guest on December-04-2020
1

using SQL in rails migration

def change
  execute <<-SQL
    UPDATE table1
    SET column1 = "value"
  SQL
end
Posted by: Guest on January-14-2021

Code answers related to "rails migration foreign key optional"

Browse Popular Code Answers by Language