Skip to content

Instantly share code, notes, and snippets.

@colemanm
Created April 16, 2013 14:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colemanm/5396619 to your computer and use it in GitHub Desktop.
Save colemanm/5396619 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'json'
require 'pg'
require 'sequel'
def database
@db ||= Sequel.connect(adapter: 'postgres',
host: 'db.snichaos.com',
user: 'postgres',
database: 'dbname')
end
pois = database[:poi]
pois.order(:poi_id).each do |r|
index_data = "#{r[:type]}, #{r[:subtype]}, #{r[:category]}"
r.update(:type_index => index_data)
puts "#{r[:poi_id]} updated."
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment