Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- set -e
- echo Hello World
- DATABASEWS =reseau
- echo ${DATABASEWS}
- printf "restore constraints"
- # kills connections
- 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();"
- #init db
- dropdb -U postgres ${DATABASEWS}
- createdb -U postgres ${DATABASEWS}
- psql -b -U postgres -h localhost -p 5432 -d ${DATABASEWS} -c "create extension postgis;"
- psql -b -U postgres -h localhost -p 5432 -d ${DATABASEWS} -c "create extension hstore;"
- psql -b -U postgres -h localhost -p 5432 -d ${DATABASEWS} -c "create schema ouvrage;"
- psql -b -U postgres -h localhost -p 5432 -d ${DATABASEWS} -c "CREATE EXTENSION \"uuid-ossp\" SCHEMA public ;"
- # dry run student scenario
- # restore raw from sql
- psql -b -U postgres -h localhost -p 5432 -d ${DATABASEWS} -f QGIS_project/data/dump_reseau.sql
- # add constraints
- printf "restore constraints"
- psql -b -U postgres -h localhost -p 5432 -d reseau -f QGIS_project/scripts_SQL/02_sql_constraints.sql
- # - add simple trigger for slope computing
- # add views
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement