Rake task to perform "view migrations" for using SQL Views with Rails. Avoids the need to copy or re-run multiple migrations when changes are made to queries providing view data.
Usage: rake db:views:load
Place SQL create statement for each view in a file as db/views/<view_name>.sql
. Optionally include a numeric prefix such as 01_first_view.sql
to order views that may have dependencies.
namespace :db do
namespace :views do
desc "Execute all stored View statements on DB connection"