Class: SchemaPlus::Views::SchemaDump::View
- Inherits:
-
Struct
- Object
- Struct
- SchemaPlus::Views::SchemaDump::View
- Defined in:
- lib/schema_plus/views/schema_dump.rb
Overview
quacks like a SchemaMonkey Dump::Table
Instance Attribute Summary collapse
-
#definition ⇒ Object
Returns the value of attribute definition.
-
#indexes ⇒ Object
Returns the value of attribute indexes.
-
#name ⇒ Object
Returns the value of attribute name.
-
#view_type ⇒ Object
Returns the value of attribute view_type.
Instance Method Summary collapse
Instance Attribute Details
#definition ⇒ Object
Returns the value of attribute definition
7 8 9 |
# File 'lib/schema_plus/views/schema_dump.rb', line 7 def definition @definition end |
#indexes ⇒ Object
Returns the value of attribute indexes
7 8 9 |
# File 'lib/schema_plus/views/schema_dump.rb', line 7 def indexes @indexes end |
#name ⇒ Object
Returns the value of attribute name
7 8 9 |
# File 'lib/schema_plus/views/schema_dump.rb', line 7 def name @name end |
#view_type ⇒ Object
Returns the value of attribute view_type
7 8 9 |
# File 'lib/schema_plus/views/schema_dump.rb', line 7 def view_type @view_type end |
Instance Method Details
#assemble(stream) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/schema_plus/views/schema_dump.rb', line 8 def assemble(stream) = ", materialized: true" if view_type == :materialized heredelim = "END_VIEW_#{name.upcase}" stream.puts <<~ENDVIEW create_view "#{name}", <<-'#{heredelim}', :force => true#{} #{definition} #{heredelim} ENDVIEW stream.puts indexes.each do |index| stream.write " add_index \"#{name}\", " index.assemble(stream) stream.puts "" end stream.puts "" end |