2019-01-01 19:52:23 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
|
|
|
|
# utiliser un compte SUPERUSER pour exécuter ce script
|
|
|
|
|
2020-02-10 12:31:30 +00:00
|
|
|
dbhost=localhost
|
|
|
|
|
|
|
|
#psql -h $dbhost -d postgres -c "DROP DATABASE IF EXISTS redadeg; DROP ROLE IF EXISTS redadeg;"
|
|
|
|
|
2019-01-01 19:52:23 +00:00
|
|
|
# create role
|
2020-02-10 12:31:30 +00:00
|
|
|
psql -h $dbhost -d postgres -c "CREATE USER redadeg WITH PASSWORD 'redadeg' SUPERUSER;"
|
2019-01-01 19:52:23 +00:00
|
|
|
|
|
|
|
# create database with owner redadeg
|
2020-02-10 12:31:30 +00:00
|
|
|
psql -h $dbhost -d postgres -c "CREATE DATABASE redadeg WITH OWNER = redadeg ENCODING = 'UTF8';"
|
|
|
|
|
|
|
|
# extensions postgis
|
|
|
|
psql -h $dbhost -d redadeg -c "CREATE EXTENSION postgis;"
|
|
|
|
psql -h $dbhost -d redadeg -c "CREATE EXTENSION postgis_topology;"
|
|
|
|
psql -h $dbhost -d redadeg -c "CREATE EXTENSION pgrouting;"
|
2019-01-01 19:52:23 +00:00
|
|
|
|
2020-02-10 12:31:30 +00:00
|
|
|
# permissions
|
|
|
|
psql -h $dbhost -d redadeg -c "ALTER SCHEMA public OWNER TO redadeg;"
|
|
|
|
psql -h $dbhost -d redadeg -c "ALTER TABLE topology.layer OWNER TO redadeg ;"
|
|
|
|
psql -h $dbhost -d redadeg -c "ALTER TABLE topology.topology OWNER TO redadeg ;"
|
2019-01-01 19:52:23 +00:00
|
|
|
|
2020-02-10 12:31:30 +00:00
|
|
|
# vérifications
|
|
|
|
psql -h $dbhost -d redadeg -c "SELECT * FROM postgis_version();"
|
|
|
|
psql -h $dbhost -d redadeg -c "SELECT * FROM pgr_version();"
|
2019-01-01 19:52:23 +00:00
|
|
|
|