Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Commit

Permalink
Add update function for postgis extension
Browse files Browse the repository at this point in the history
  • Loading branch information
francbartoli committed Jan 10, 2018
1 parent c83cbc7 commit 2390655
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions initdb-geonode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ function create_geonode_user_and_geodatabase() {
ALTER USER $geodb with encrypted password '$GEONODE_GEODATABASE_PASSWORD';
CREATE DATABASE $geodb;
GRANT ALL PRIVILEGES ON DATABASE $geodb TO $geodb;
EOSQL
}

function update_geodatabase_with_postgis() {
local geonode_data=$1
echo " Updating geodatabase '$geonode_data' with extension"
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$geonode_data" <<-EOSQL
CREATE EXTENSION postgis;
EOSQL
}
Expand All @@ -33,5 +40,6 @@ fi
if [ -n "$GEONODE_GEODATABASE" ]; then
echo "Geonode geodatabase creation requested: $GEONODE_GEODATABASE"
create_geonode_user_and_geodatabase $GEONODE_GEODATABASE
update_geodatabase_with_postgis $GEONODE_GEODATABASE
echo "Geonode geodatabase created"
fi

0 comments on commit 2390655

Please sign in to comment.