Created
July 29, 2011 16:13
-
-
Save toreriklinnerud/1114138 to your computer and use it in GitHub Desktop.
Drop and recreate all views after database migrations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desc "Drop and create all views" | |
task 'db:reload_views' => :environment do | |
ActiveRecord::Migration.verbose = false | |
Logger.new(STDOUT).debug('Rebuilding Views...') | |
ActiveRecord::Migrator.down('db/views/') | |
ActiveRecord::Migrator.up('db/views/') | |
ActiveRecord::Migration.verbose = true | |
end | |
Rake::Task['db:migrate'].enhance do | |
Rake::Task['db:reload_views'].invoke | |
end | |
desc "Drop all views" | |
task 'db:drop_views' => :environment do | |
ActiveRecord::Migration.verbose = false | |
Logger.new(STDOUT).debug('Drop Views...') | |
ActiveRecord::Migrator.down('db/views/') | |
ActiveRecord::Migration.verbose = true | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment