diff --git a/docs/setup-dev-environment.md b/docs/setup-dev-environment.md index 1d2ba0bd..734c5c8b 100644 --- a/docs/setup-dev-environment.md +++ b/docs/setup-dev-environment.md @@ -230,8 +230,12 @@ npm install ## :house: Loading the building data +There are several ways to create the Colouring London database in your environment. The simplest way if you are just trying out the application would be to use test data from OSM, but otherwise you should follow one of the instructions below to create the full database either from scratch, or from a previously made db (via a dump file). + +To create the full database from scratch, follow [these instructions](../etl/README.md), otherwise choose one of the following: +
- With a database dump

+ Create database from dump

If you are a developer on the Colouring London project (or another Colouring Cities project), you may have a production database (or staging etc) that you wish to duplicate in your development environment. @@ -261,7 +265,7 @@ ls ~/colouring-london/migrations/*.up.sql 2>/dev/null | while read -r migration;
- With test data

+ Create database with test data

This section shows how to load test buildings into the application from OpenStreetMaps (OSM). diff --git a/etl/README.md b/etl/README.md index 60f25780..93554116 100644 --- a/etl/README.md +++ b/etl/README.md @@ -1,4 +1,6 @@ -# Data loading +# Creating a Colouring London database from scratch + +## Data loading The scripts in this directory are used to extract, transform and load (ETL) the core datasets for Colouring London: @@ -8,20 +10,13 @@ for Colouring London: ## Prerequisites -Install PostgreSQL and create a database for colouringlondon, with a database -user that can connect to it. The [PostgreSQL -documentation](https://www.postgresql.org/docs/12/tutorial-start.html) covers -installation and getting started. +You should already have set up PostgreSQL and created a database. Make sure to create environment variables to use `psql` if you haven't already: -Install the [PostGIS extension](https://postgis.net/). - -Connect to the colouringlondon database and add the PostGIS, pgcrypto and -pg_trgm extensions: - -```sql -create extension postgis; -create extension pgcrypto; -create extension pg_trgm; +```bash +export PGPASSWORD= +export PGUSER= +export PGHOST=localhost +export PGDATABASE= ``` Create the core database tables: @@ -88,4 +83,6 @@ psql < ../migrations/003.index-buildings.up.sql ## Finally -Run the remaining migrations in `../migrations` to create the rest of the database structure. \ No newline at end of file +Run the remaining migrations in `../migrations` to create the rest of the database structure. + +# Updating the Colouring London database with new OS data \ No newline at end of file