Skip to content

Instantly share code, notes, and snippets.

@mathildathompson
Created March 11, 2014 05:35
Show Gist options
  • Select an option

  • Save mathildathompson/9480027 to your computer and use it in GitHub Desktop.

Select an option

Save mathildathompson/9480027 to your computer and use it in GitHub Desktop.
- Username and password;
- \h => help;
-\c butterflies_app;
-\d (desribe the table)
- cp -r butterflies_app butterflies_pg_app
-psql --help
- psql -f butterflies.sql butterflies_app (run where the butterflies.sql is)
-\d butterflies
-We need to connect to the postgres database;
db = PG.connect(:dbname => 'butterflies_app', :host => 'localhost')
puts "SQL: #{sql}"
results = db.exec(sql)
db.close
results
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment