Skip to content

Commit 88f603a

Browse files
committedDec 1, 2012
check if db already exists
1 parent b89e0b4 commit 88f603a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed
 

‎createdb.sh

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
createdb -U postgres -O libertree -E UTF8 libertree_development
2-
createdb -U postgres -O libertree -E UTF8 libertree_test
3-
createdb -U postgres -O libertree -E UTF8 libertree_production
1+
for db in "test" "development" "production"; do
2+
if psql -U postgres -l | grep -wq "libertree_$db"; then
3+
echo "Already exists: libertree_$db"
4+
else
5+
createdb -U postgres -O libertree -E UTF8 "libertree_$db"
6+
fi
7+
done

0 commit comments

Comments
 (0)
Please sign in to comment.