Created
July 30, 2013 21:16
-
-
Save sampottinger/6117051 to your computer and use it in GitHub Desktop.
Candidate setup script for denver_streets, creating the denver_streets local development database with the postgis extensions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Convenience script to create a local development database for denver_streets. | |
# | |
# Convenience script to create the local development database needed for | |
# denver streets, adding the postgis extensions as necessary. Note that this | |
# does not create the test database. | |
# | |
# @author A. Samuel Pottinger (samnsparky, Gleap LLC) | |
# @param $1 The name of the user to create for manipulating the dev database. | |
# this is typically the user specified in config.yaml. Optional but user | |
# will only be created if a password is specified. | |
# @param $2 The password to use in the creation of that user. Optional but user | |
# will only be created if a password is specified. | |
if [ $# -eq 2 ] | |
then | |
psql -c "CREATE ROLE $1 CREATEDB LOGIN PASSWORD '$2';" | |
elif [ $# -ne 0 ] | |
then | |
echo "usage: setup.bash [desired user] [desired password]" | |
echo "" | |
echo "user: The user to create for manipulating the dev database." | |
echo "password: The password for that user." | |
echo "" | |
exit | |
fi | |
python -c "import database; database.create_db();"; | |
createlang plpgsql denver_streets; | |
psql -d denver_streets -c "CREATE EXTENSION IF NOT EXISTS postgis"; | |
python -c "import database; database.init_db();" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment