How to check if the database exists or not in rails before doing a rake db:setup?
I would like to check if a database already exists before a db:create is being done
You can also count on the fact that rake db:migrate returns an error if the database does not yet exist.
rake db:migrate
I used something like this in my scripts:
rake db:migrate 2>/dev/null || rake db:setup
(Inspired by penguincoder)