Module: PGAssets::ViewsMigrationHelper

Defined in:
lib/pg_assets/helpers/views_migration_helper.rb

Instance Method Summary collapse

Instance Method Details

#touching_materialized_view(view_name, new_defn = nil, &proc) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/pg_assets/helpers/views_migration_helper.rb', line 46

def touching_materialized_view(view_name, new_defn=nil, &proc)
  matview = ::PGAssets::Services::PGAssetManager.specific_matview(view_name.to_sym)
  matview.remove

  proc.call

  if new_defn.nil?
    matview.reinstall
  else
    matview.reinstall(defn=new_defn)
  end
end

#touching_view(view_name, new_defn = nil, &proc) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/pg_assets/helpers/views_migration_helper.rb', line 33

def touching_view(view_name, new_defn=nil, &proc)
  view = ::PGAssets::Services::PGAssetManager.specific_view(view_name.to_sym)
  view.remove

  proc.call

  if new_defn.nil?
    view.reinstall
  else
    view.reinstall(defn=new_defn)
  end
end