Skip to content

Instantly share code, notes, and snippets.

@krukgit
krukgit / character_set_and_collation.rb
Last active September 2, 2015 10:42 — forked from tjh/character_set_and_collation.rb
Convert all Rails table column collation and character set.
DATABASE = ''
CHARACTER_SET = 'utf8'
COLLATION = 'utf8_general_ci'
schema = File.open('db/schema.rb', 'r').read
rows = schema.split("\n")
table_name = nil
rows.each do |row|
if row =~ /create_table/