prise en charge millesime database

This commit is contained in:
MaelREBOUX 2021-03-10 09:00:24 +01:00
parent 302f85f726
commit 360475a524

View file

@ -9,25 +9,25 @@ PSQL=/usr/bin/psql
DB_HOST=localhost DB_HOST=localhost
DB_NAME=redadeg_$millesime DB_NAME=redadeg_$millesime
psql -h $dbhost -d postgres -c "DROP DATABASE IF EXISTS $DB_NAME; DROP ROLE IF EXISTS redadeg;" psql -h $DB_HOST -d postgres -c "DROP DATABASE IF EXISTS $DB_NAME; DROP ROLE IF EXISTS redadeg;"
# create role # create role
psql -h $dbhost -d postgres -c "CREATE USER redadeg WITH PASSWORD 'redadeg' SUPERUSER;" psql -h $DB_HOST -d postgres -c "CREATE USER redadeg WITH PASSWORD 'redadeg' SUPERUSER;"
# create database with owner redadeg # create database with owner redadeg
psql -h $dbhost -d postgres -c "CREATE DATABASE $DB_NAME WITH OWNER = redadeg ENCODING = 'UTF8';" psql -h $DB_HOST -d postgres -c "CREATE DATABASE $DB_NAME WITH OWNER = redadeg ENCODING = 'UTF8';"
# extensions postgis # extensions postgis
psql -h $dbhost -d $DB_NAME -c "CREATE EXTENSION postgis;" psql -h $DB_HOST -d $DB_NAME -c "CREATE EXTENSION postgis;"
psql -h $dbhost -d $DB_NAME -c "CREATE EXTENSION postgis_topology;" psql -h $DB_HOST -d $DB_NAME -c "CREATE EXTENSION postgis_topology;"
psql -h $dbhost -d $DB_NAME -c "CREATE EXTENSION pgrouting;" psql -h $DB_HOST -d $DB_NAME -c "CREATE EXTENSION pgrouting;"
# permissions # permissions
psql -h $dbhost -d $DB_NAME -c "ALTER SCHEMA public OWNER TO redadeg;" psql -h $DB_HOST -d $DB_NAME -c "ALTER SCHEMA public OWNER TO redadeg;"
psql -h $dbhost -d $DB_NAME -c "ALTER TABLE topology.layer OWNER TO redadeg ;" psql -h $DB_HOST -d $DB_NAME -c "ALTER TABLE topology.layer OWNER TO redadeg ;"
psql -h $dbhost -d $DB_NAME -c "ALTER TABLE topology.topology OWNER TO redadeg ;" psql -h $DB_HOST -d $DB_NAME -c "ALTER TABLE topology.topology OWNER TO redadeg ;"
# vérifications # vérifications
psql -h $dbhost -d $DB_NAME -c "SELECT * FROM postgis_version();" psql -h $DB_HOST -d $DB_NAME -c "SELECT * FROM postgis_version();"
psql -h $dbhost -d $DB_NAME -c "SELECT * FROM pgr_version();" psql -h $DB_HOST -d $DB_NAME -c "SELECT * FROM pgr_version();"