Advertisement
Guest User

Untitled

a guest
Nov 20th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. set -e
  4. echo Hello World
  5.  
  6. DATABASEWS =reseau
  7.  
  8. echo ${DATABASEWS}
  9. printf "restore constraints"
  10.  
  11. # kills connections
  12. psql -U postgres ${DATABASEWS} -c "SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname ='${DATABASEWS}' AND pid <> pg_backend_pid();"
  13.  
  14. #init db
  15.  
  16.  
  17. dropdb -U postgres ${DATABASEWS}
  18.  
  19. createdb -U postgres ${DATABASEWS}
  20.  
  21. psql -b -U postgres -h localhost -p 5432 -d ${DATABASEWS} -c "create extension postgis;"
  22.  
  23. psql -b -U postgres -h localhost -p 5432 -d ${DATABASEWS} -c "create extension hstore;"
  24.  
  25. psql -b -U postgres -h localhost -p 5432 -d ${DATABASEWS} -c "create schema ouvrage;"
  26.  
  27. psql -b -U postgres -h localhost -p 5432 -d ${DATABASEWS} -c "CREATE EXTENSION \"uuid-ossp\" SCHEMA public ;"
  28.  
  29.  
  30.  
  31.  
  32.  
  33. # dry run student scenario
  34.  
  35. # restore raw from sql
  36.  
  37. psql -b -U postgres -h localhost -p 5432 -d ${DATABASEWS} -f QGIS_project/data/dump_reseau.sql
  38.  
  39.  
  40.  
  41. # add constraints
  42.  
  43. printf "restore constraints"
  44.  
  45. psql -b -U postgres -h localhost -p 5432 -d reseau -f QGIS_project/scripts_SQL/02_sql_constraints.sql
  46.  
  47.  
  48. # - add simple trigger for slope computing
  49.  
  50. # add views
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement