view backend/doc/schema/postgresql-setup.sh @ 8443:df65f24af5bc

(issue1762) Use getValue to obtain dateRange values The getToValue was always the initial value regardless of what has been entered in the form. According to the documentation both getToValue and getFromValue should return the "initial value" of the form field. But wether this means the value before validation corrections or the value the field is initialized with (which is also not true in both cases as the field is set only after creation) It returned the real value for the from date but not for the to date. With an explicit getValue we workaround this issue.
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 22 Oct 2014 17:33:43 +0200
parents 4ad2b530dbba
children c1cea6c95967
line wrap: on
line source
#!/bin/bash

# $1: user name and password for new DB (equals DB name)
# $2: path to directory with schema-scripts
# $3: host

# run as user postgres (postgresql super-user)
# it is assumed that the owner of the DB has the same name as the DB!

# create PostGIS-DB
createuser -S -D -R $1
createdb $1
createlang plpgsql $1
# Path appears e.g. as /usr/share/postgresql/contrib/postgis-1.5/ on some systems,
# /usr/share/postgresql/8.4/contrib/postgis-1.5/ on others
POST_INIT_DIR=`find /usr/share/postgresql/ -name spatial_ref_sys.sql | sed -n '1p'`
POST_INIT_DIR=`dirname $POST_INIT_DIR`
psql -d $1 -f $POST_INIT_DIR/postgis.sql
psql -d $1 -f $POST_INIT_DIR/spatial_ref_sys.sql
psql -d $1 -c "ALTER USER $1 WITH PASSWORD '$1';"
psql -d $1 -c "GRANT ALL ON geometry_columns TO $1; GRANT ALL ON geography_columns TO $1; GRANT ALL ON spatial_ref_sys TO $1;"

# add credentials to .pgpass (or create .pgpass)
echo "*:*:$1:$1:$1" >> ~/.pgpass
chmod 0600 ~/.pgpass

# apply schema-scripts
psql -d $1 -U $1 -h $3 -f $2/postgresql.sql
psql -d $1 -U $1 -h $3 -f $2/postgresql-spatial.sql
psql -d $1 -U $1 -h $3 -f $2/postgresql-minfo.sql

http://dive4elements.wald.intevation.org