Skip to content

Commit

Permalink
Create database if not exist.
Browse files Browse the repository at this point in the history
So that running rake a second time doesn't fail because database already
exists.

Signed-off-by: Anurag Priyam <[email protected]>
  • Loading branch information
yeban committed Feb 4, 2015
1 parent 9cbe4ee commit d73d920
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ end

desc 'Create database.'
task 'db:init', [:name] do |t, args|
system "createdb -e #{args[:name] || 'afra'}"
name = args[:name] || 'afra'
system "createdb -e #{name}" unless system "psql -l | grep #{name}"
end

desc 'Migrate database.'
Expand Down

0 comments on commit d73d920

Please sign in to comment.