Created
November 25, 2015 16:25
-
-
Save austinthecoder/58c16c1328a13a83404f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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