Skip to content

Instantly share code, notes, and snippets.

@matthewberryman
Last active December 6, 2015 22:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthewberryman/03e56417f9bc8fa7cdd1 to your computer and use it in GitHub Desktop.
Save matthewberryman/03e56417f9bc8fa7cdd1 to your computer and use it in GitHub Desktop.
fresh-cognicity-database
#!/usr/bin/env bash
# assumes https://github.com/smart-facility/cognicity-schema and https://github.com/smart-facility/cognicity-reports
# both checked out using default directory names (matching trailing part of url)
createdb -U postgres -h $DB_HOST -E utf8 cognicity
cd cognicity-schema
psql -U postgres -h $DB_HOST -d cognicity -f schema.sql
cd sample_data/infrastructure
find . -name '*.sql' -exec psql -U postgres -h $DB_HOST -d cognicity -f {} ';'
cd ../municipal_boundaries
find . -name '*.sql' -exec psql -U postgres -h $DB_HOST -d cognicity -f {} ';'
cd ../../../cognicity-reports
find . -name 'update_schema_*.sql' -exec psql -U postgres -h $DB_HOST -d cognicity -f {} ';'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment