Module: Viewmatic::Migration
- Defined in:
- lib/viewmatic/migration.rb
Overview
Helpers for creating and dropping views in ActiveRecord migrations.
Instance Method Summary collapse
-
#create_view(name) ⇒ Object
Create the view named in “name”.
-
#drop_view(name, materialized: false) ⇒ Object
Drop the view named in “name”.
Instance Method Details
#create_view(name) ⇒ Object
Create the view named in “name”. It must be defined in the view definitions file.
11 12 13 14 |
# 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) ⇒ Object
Drop the view named in “name”. It must be defined in the view definitions file.
22 23 24 25 |
# 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 |