Method: Scenic::Statements#drop_view

Defined in:
lib/scenic/statements.rb

#drop_view(name, revert_to_version: nil, materialized: false) ⇒ Object

Drop a database view by name.

Examples:

Drop a view, rolling back to version 3 on rollback

drop_view(:users_who_recently_logged_in, revert_to_version: 3)

Parameters:

  • name (String, Symbol)

    The name of the database view.

  • revert_to_version (Fixnum) (defaults to: nil)

    Used to reverse the drop_view command on rake db:rollback. The provided version will be passed as the version argument to #create_view.

  • materialized (Boolean) (defaults to: false)

    Set to true if dropping a meterialized view. defaults to false.

Returns:

  • The database response from executing the drop statement.



63
64
65
66
67
68
69
# File 'lib/scenic/statements.rb', line 63

def drop_view(name, revert_to_version: nil, materialized: false)
  if materialized
    Scenic.database.drop_materialized_view(name)
  else
    Scenic.database.drop_view(name)
  end
end