Class: PGAssets::PGMatView
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- PGAssets::PGMatView
- Includes:
- LoadableAsset
- Defined in:
- lib/pg_assets/models/pg_mat_view.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.by_name(name) ⇒ Object
13 14 15 |
# File 'lib/pg_assets/models/pg_mat_view.rb', line 13 def self.by_name(name) where(matviewname: name.to_s) end |
Instance Method Details
#identity ⇒ Object
17 18 19 |
# File 'lib/pg_assets/models/pg_mat_view.rb', line 17 def identity schemaname + '.' + matviewname end |
#sql_for_reinstall(defn = cached_defn) ⇒ Object
25 26 27 |
# File 'lib/pg_assets/models/pg_mat_view.rb', line 25 def sql_for_reinstall(defn=cached_defn) sql = "#{sql_for_remove}; CREATE MATERIALIZED VIEW #{schemaname}.#{matviewname} AS #{defn}" end |
#sql_for_remove ⇒ Object
21 22 23 |
# File 'lib/pg_assets/models/pg_mat_view.rb', line 21 def sql_for_remove sql = "DROP MATERIALIZED VIEW IF EXISTS #{schemaname}.#{matviewname}" end |