module Viewmatic::Migration

Helpers for creating and dropping views in ActiveRecord migrations.

Public Instance Methods

create_view(name) click to toggle source

Create the view named in “name”. It must be defined in the view definitions file.

@param name [Symbol]

# File lib/viewmatic/migration.rb, line 11
def create_view(name)
  view = Viewmatic.view name
  execute SchemaStatements.create_view view
end
drop_view(name, materialized: false) click to toggle source

Drop the view named in “name”. It must be defined in the view definitions file.

@param name [Symbol] @param materialized [Boolean] true if you're dropping a materialized view

# File lib/viewmatic/migration.rb, line 22
def drop_view(name, materialized: false)
  view = View.new name, materialized: materialized
  execute SchemaStatements.drop_view view
end