Skip to content

Instantly share code, notes, and snippets.

@austinthecoder
Created November 25, 2015 16:25
Show Gist options
  • Save austinthecoder/58c16c1328a13a83404f to your computer and use it in GitHub Desktop.
Save austinthecoder/58c16c1328a13a83404f to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'csv'
file_path = ARGV[0]
CSV.readlines(file_path).each do |row|
next if row[0] == 'Factor'
table = {
'Seat' => 'seats',
'Power' => 'powers',
'Wi-Fi' => 'wifis',
'Layout' => 'layouts',
'Fresh food' => 'foods',
'Entertainment' => 'entertainments',
}[row[0]]
new_name = row[3]
code = row[1]
puts "update #{table} set name = #{new_name.inspect} where code = #{code.inspect};"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment