theodi / uk-postcodes

MIT License
41 stars 17 forks source link

Postgres DB setup #26

Closed jdrydn closed 10 years ago

jdrydn commented 10 years ago

Hi there,

Am I having a bad Monday or is there a simple way to get the Postgres DB up and running? I have no idea what username / password, schema, etc etc to use for this API.

Am I missing a simple setup script? Everything else seemed to be relatively simple (just installing dependency after dependency!)

Thanks!

pezholio commented 10 years ago

Yeah, it is a bit tricky getting the Postgres stuff into play. Assuming you're on a Mac, the easiest way to install PostGIS is to install Postgres.app, then run the following commands to get the DB set up:

psql -c 'CREATE USER root with SUPERUSER;' -U postgres
psql -c 'CREATE DATABASE uk_postcodes_development;' -U postgres
psql -d uk_postcodes_development -c 'CREATE SCHEMA postgis; CREATE EXTENSION postgis WITH SCHEMA postgis;' -U postgres

Then run rake db:migrate as normal.

Any issues, please give me a shout!