Skip to content

Commit

Permalink
Merge pull request #1070 from postmodern/database_tasks
Browse files Browse the repository at this point in the history
Database tasks
  • Loading branch information
nesquena committed Feb 22, 2013
2 parents 46e4174 + a48549b commit f4a6aea
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if PadrinoTasks.load?(:seed, true)
if PadrinoTasks.load?(:database, true)
namespace :db do
desc 'Load the seed data from db/seeds.rb'
task :seed => :environment do
Expand All @@ -8,4 +8,4 @@
end

task :seed => 'db:seed'
end
end
10 changes: 9 additions & 1 deletion padrino-gen/lib/padrino-gen/padrino-tasks/datamapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,15 @@
end

desc "Migrate the database to the latest version"
task :migrate => 'dm:migrate:up'
task :migrate do
migrate_task = if Dir['db/migrate/*.rb'].empty?
'dm:auto:upgrade'
else
'dm:migrate:up'
end

Rake::Task[migrate_task].invoke
end

desc "Create the database"
task :create => :environment do
Expand Down

0 comments on commit f4a6aea

Please sign in to comment.