Module: Viewmatic::SchemaStatements
- Defined in:
- lib/viewmatic/schema_statements.rb
Class Method Summary collapse
Class Method Details
.create_view(v) ⇒ Object
3 4 5 6 7 |
# File 'lib/viewmatic/schema_statements.rb', line 3 def self.create_view(v) mat = v.materialized ? 'MATERIALIZED' : nil cols = v.column_names ? "(#{v.column_names.join ', '})" : nil %Q(CREATE #{mat} VIEW #{v.name} #{cols} AS #{v.query}) end |
.drop_view(v) ⇒ Object
9 10 11 12 |
# File 'lib/viewmatic/schema_statements.rb', line 9 def self.drop_view(v) mat = v.materialized ? 'MATERIALIZED' : nil %Q(DROP #{mat} VIEW IF EXISTS #{v.name}) end |