Database Design - smart-fm/simmobility-prod GitHub Wiki

Mid-term database

Mid term database consist of 4 schemas

  • Demand Schema contains the tables related to demand for mid term e.g. daily activity schedule
  • Route choice schema contains the tables related to route choice e.g. choice set table
  • Supply Schema contains table related to supply side data e.g. road network
  • Output schema contains tables generated from simulation

Demand Schema

Route choice schema

Supply schema

Create Database Schema with Prototypical City Data (simmobcity)

Steps to create Database

  1. Download the simmobcity archive file from this link and save it on the Postgres server
  2. Create a new database (i.e. simmobcity) in postgres
  3. Ensure access is granted to the new database by checking the pg_hba.conf file. If required, include the new database in pg_hba.conf file and restart postgres.
  4. At the terminal prompt of the Postgres server, change directory to the path containing the downloaded archive file
  5. Enter the following command to restore the database schema and data pg_restore -U postgres -h localhost -O -x simmobcity.archive.20181205 -d simmobcity

Documentation on the pg_restore command can be found here.

Create Database Schema (without data)

Follow the same steps as above. For step 5, use the -s or --schema-only option in the pg_restore command. pg_restore -U postgres -h localhost -O -x -s simmobcity.archive.20181205 -d simmobcity