Skip to content

Commit

Permalink
Create misssing schema.rb as part of the db:setup rake task
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimitrij Denissenko committed Dec 5, 2009
1 parent 465b99f commit c6780e5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -4,3 +4,5 @@ coverage
Capfile
.tmp*
*.*~
vendor/gems
vendor/rails
6 changes: 0 additions & 6 deletions config/preinitializer.rb
@@ -1,6 +0,0 @@
require 'fileutils'

# Create a schema.rb file if it is missing
unless File.exist?(File.join(File.dirname(__FILE__), '..', 'db', 'schema.rb'))
FileUtils.cp File.join(File.dirname(__FILE__), '..', 'db', 'schema.core.rb'), File.join(File.dirname(__FILE__), '..', 'db', 'schema.rb')
end
10 changes: 10 additions & 0 deletions lib/tasks/database.rake
@@ -1,3 +1,5 @@
require 'fileutils'

namespace :db do
namespace :retro do
task :load do
Expand All @@ -6,3 +8,11 @@ namespace :db do
end
end

Rake::Task['db:setup'].enhance do

# Create a schema.rb file if it is missing
unless File.exist?(File.join(File.dirname(__FILE__), '..', 'db', 'schema.rb'))
FileUtils.cp File.join(File.dirname(__FILE__), '..', 'db', 'schema.core.rb'), File.join(File.dirname(__FILE__), '..', 'db', 'schema.rb')
end

end

0 comments on commit c6780e5

Please sign in to comment.