Clean up vagrant postgres user creation code

We don't need to check whether the user exists before creating it:
CREATE USER failing is fine.

(imported from commit e8b2bc5495e328ee30d15445a566c0edff2f069d)
This commit is contained in:
Reid Barton 2015-08-20 15:39:39 -07:00 committed by Tim Abbott
parent 748f931999
commit 53c2b3f6f4
1 changed files with 1 additions and 10 deletions

View File

@ -34,16 +34,7 @@ ALTER USER $USERNAME PASSWORD '$PASSWORD';
ALTER USER $USERNAME CREATEDB;
ALTER ROLE $USERNAME SET search_path TO $SEARCH_PATH;
DO \$\$
BEGIN
IF NOT EXISTS (
SELECT * FROM pg_catalog.pg_user WHERE usename -- [sic]
= '$VAGRANTUSERNAME') THEN
CREATE USER $VAGRANTUSERNAME;
END IF;
END
\$\$ ;
CREATE USER $VAGRANTUSERNAME;
GRANT $USERNAME TO $VAGRANTUSERNAME;
ALTER ROLE $VAGRANTUSERNAME SET search_path TO $SEARCH_PATH;
EOF