Module: Spectacles::SchemaStatements::SQLServerAdapter
- Includes:
- AbstractAdapter
- Defined in:
- lib/spectacles/schema_statements/sqlserver_adapter.rb
Instance Method Summary collapse
Methods included from AbstractAdapter
#create_materialized_view, #create_view, #create_view_statement, #drop_materialized_view, #drop_view, #drop_view_statement, #materialized_view_build_query, #materialized_view_exists?, #materialized_views, #refresh_materialized_view, #refresh_materialized_view_concurrently, #supports_materialized_views?, #view_exists?
Instance Method Details
#view_build_query(view, name = nil) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/spectacles/schema_statements/sqlserver_adapter.rb', line 12 def view_build_query(view, name = nil) q = <<-ENDSQL SELECT view_definition FROM information_schema.views WHERE table_name = '#{view}' ENDSQL q = select_value(q, name) or raise "No view called #{view} found" q.gsub(/CREATE VIEW .*? AS/i, "") end |
#views(name = nil) ⇒ Object
:nodoc:
8 9 10 |
# File 'lib/spectacles/schema_statements/sqlserver_adapter.rb', line 8 def views(name = nil) # :nodoc: select_values("SELECT table_name FROM information_schema.views", name) end |