Class: Spectacles::MaterializedView

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/spectacles/materialized_view.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.materialized_view_exists?Boolean Also known as: table_exists?

Returns:

  • (Boolean)


9
10
11
# File 'lib/spectacles/materialized_view.rb', line 9

def self.materialized_view_exists?
  connection.materialized_view_exists?(view_name)
end

.newObject

Raises:

  • (NotImplementedError)


5
6
7
# File 'lib/spectacles/materialized_view.rb', line 5

def self.new(*)
  raise NotImplementedError, "#{self} is an abstract class and cannot be instantiated."
end

.refresh!(concurrently: false) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/spectacles/materialized_view.rb', line 13

def self.refresh!(concurrently: false)
  if concurrently
    connection.refresh_materialized_view_concurrently(view_name)
  else
    connection.refresh_materialized_view(view_name)
  end
end

.refresh_concurrently!Object



21
22
23
# File 'lib/spectacles/materialized_view.rb', line 21

def self.refresh_concurrently!
  refresh!(concurrently: true)
end

Instance Method Details

#==(other) ⇒ Object



30
31
32
33
34
35
# File 'lib/spectacles/materialized_view.rb', line 30

def ==(other)
  super ||
    other.instance_of?(self.class) &&
      attributes.present? &&
      other.attributes == attributes
end

#persisted?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/spectacles/materialized_view.rb', line 37

def persisted?
  false
end

#readonly?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/spectacles/materialized_view.rb', line 41

def readonly?
  true
end