forked from opendatadurban/scoda
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDatabaseSetup
More file actions
26 lines (20 loc) · 1.28 KB
/
DatabaseSetup
File metadata and controls
26 lines (20 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
These are the steps to get the db setup
1. Download and install postgis locally http://download.osgeo.org/postgis/windows/pg96/
2. Setup the db on your local Postgres with the following commands:
cd C:\Program Files\PostgreSQL\9.6
psql -U postgres
CREATE DATABASE scoda;
3. Add relevant permissions + extensions
CREATE USER scoda;
GRANT ALL PRIVILEGES ON DATABASE scoda TO scoda;
ALTER USER scoda WITH ENCRYPTED PASSWORD 'scoda';
psql -d scoda -c "CREATE EXTENSION postgis;"
psql -U postgres -d scoda -c "CREATE EXTENSION postgis;"
psql -U postgres -d scoda -c "CREATE EXTENSION postgis_topology;"
4. From the app side download the additional data from the google drive and copy it to the data folder in the scoda project
5. After installing requirements and activating your local environment run "python rebuild_db.py"
Additional step to restore db if required:
1. Completed step 1,2 & 3 above. Steps 4,5 not required for this setup.
2. Download the dump_scoda_new.sql from the following folder: https://drive.google.com/drive/folders/1tnI_EveGeeJg8-WnP5Js2doMDsQGT2Vh
3. Open windows CMD and CD into your local postgres bin dir (e.g. C:\Program Files\PostgreSQL\9.6\bin)
4. psql --dbname=scoda --username=postgres --host=localhost --port=5432 -f C:\Users\Admin\Downloads\Work\scoda\dump_scoda_new.sql