module Viewmatic::SchemaStatements

Public Class Methods

create_view(v) click to toggle source
# 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) click to toggle source
# 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