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
# db/migrate/20131118172653_create_transactional_items_view.rb | |
class CreateTransactionalItemsView < ActiveRecord::Migration | |
def up | |
select_sql = File.open("#{Rails.root}/db/migrate/20131118172653_create_transactional_items_view.sql", 'r') { |f| f.read } | |
# for materialized view: | |
view_sql = "CREATE MATERIALIZED VIEW transactional_items AS (#{select_sql})" | |
# for normal view: | |
view_sql = "CREATE VIEW transactional_items AS (#{select_sql})" | |
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
# before tasks/rails | |
require "rake/exceptional" |