Revert "Change way, new DBs are created"

This reverts commit 3398143f9b.
This commit is contained in:
fly 2019-12-03 18:26:35 +00:00
parent 07c131114e
commit 9643de1ef3
2 changed files with 5 additions and 6 deletions

View file

@ -62,7 +62,9 @@ if [ ! -z "$man_user" ]; then
db_user="$man_user"
fi
createdb --encoding=UTF8 --owner=$db_user --template=osm2city_template "$database"
sudo -u postgres createdb --encoding=UTF8 --owner=$db_user "$database"
sudo -u postgres psql --dbname="$database" -c "CREATE EXTENSION postgis;"
sudo -u postgres psql --dbname="$database" -c "CREATE EXTENSION hstore;"
psql -d "$database" -f sql/pgsnapshot_schema_0.6.sql
psql -d "$database" -f sql/pgsnapshot_schema_0.6_bbox.sql

View file

@ -117,15 +117,12 @@ if [ "$skip_sql" != 1 ]; then
read db_user
echo "Please enter a password: "
read db_passwd
sudo -u postgres psql -c "CREATE USER $db_user WITH PASSWORD '$db_passwd'; ALTER USER $db_user CREATEDB;"
sudo -u postgres psql -c "CREATE USER $db_user WITH PASSWORD '$db_passwd';"
echo "db_user=$db_user" >> general-settings
echo "db_passwd=\"$db_passwd\"" >> general-settings
echo "db_passwd=$db_passwd" >> general-settings
fi
fi
echo "Creating template database..."
sudo -u postgres createdb --encoding=UTF8 osm2city_template && psql --dbname="$database" -c "CREATE EXTENSION postgis;" && psql --dbname="$database" -c "CREATE EXTENSION hstore;" && psql -c "ALTER DATABASE osm2city_template OWNER TO $db_user;"
if [ ! -f general-settings ]; then
echo "# This file must be used with "source general-settings" *from bash*" > general-settings
echo "# you cannot run it directly" >> general-settings