From d52e484921a5520ed4c96bcdd87c6790445b60ed Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Wed, 23 Feb 2022 12:42:14 +0000 Subject: [PATCH] move where migrations run --- docs/setup-dev-environment.md | 38 +++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/docs/setup-dev-environment.md b/docs/setup-dev-environment.md index 13bada83..4337ec4b 100644 --- a/docs/setup-dev-environment.md +++ b/docs/setup-dev-environment.md @@ -162,12 +162,13 @@ sudo -u postgres psql -c "SELECT 1 FROM pg_user WHERE usename = '';" | _TODO: temp instruction, find a better place to move this:_ > If you are creating from a CL db, run the above with `` as "cldbadmin" and use that from now on, but also run the above a second time with `` as "clwebapp". -Set the `` as an environment variable. +Set environment variables, which will simplify running subsequent `psql` commands. ```bash export PGPASSWORD= export PGUSER= export PGHOST=localhost +export PGDATABASE= ``` Create a colouring london database if none exists. The name (``) is arbitrary. @@ -179,7 +180,7 @@ sudo -u postgres psql -c "SELECT 1 FROM pg_database WHERE datname = ' +psql ``` In `psql`, necessary postgres extensions. @@ -235,6 +236,15 @@ In your Ubuntu installation where you have been running these setup steps (e.g. psql -d < ``` +Run migrations. + +Now run all 'up' migrations to create tables, data types, indexes etc. The `.sql` scripts to +do this are located in the `migrations` folder of your local repository. + +```bash +ls ~/colouring-london/migrations/*.up.sql 2>/dev/null | while read -r migration; do psql -d < $migration; done; +``` +
@@ -287,12 +297,6 @@ pip install -r requirements.txt To help test the Colouring London application, `get_test_polygons.py` will attempt to save a small (1.5kmĀ²) extract from OpenStreetMap to a format suitable for loading to the database. -First open `colouring-london/etl/load_geometries.sh` and `colouring-london/etl/create_building_records.sh` and add this `-d` flag to all the `psql` statements present (two in the former, one in the latter): - -```bash --d -``` - Download the test data. ```bash @@ -305,6 +309,15 @@ rm: cannot remove 'test_buildings.geojson': No such file or directory rm: cannot remove 'test_buildings.3857.csv': No such file or directory ``` +Run migrations. + +Now run all 'up' migrations to create tables, data types, indexes etc. The `.sql` scripts to +do this are located in the `migrations` folder of your local repository. + +```bash +ls ~/colouring-london/migrations/*.up.sql 2>/dev/null | while read -r migration; do psql -d < $migration; done; +``` + Load all building outlines. ```bash @@ -318,15 +331,6 @@ Create a building record per outline. ```
-#### Run migrations - -Now run all 'up' migrations to create tables, data types, indexes etc. The `.sql` scripts to -do this are located in the `migrations` folder of your local repository. - -```bash -ls ./colouring-london/migrations/*.up.sql 2>/dev/null | while read -r migration; do psql -d < $migration; done; -``` - ## Running the application Now we are ready to run the application. The `APP_COOKIE_SECRET` is arbitrary.