Class: PgMeta::View

Inherits:
Table show all
Defined in:
lib/pg_meta/meta.rb

Direct Known Subclasses

MaterializedView

Instance Attribute Summary collapse

Attributes inherited from Table

#check_constraints, #columns, #constraints, #primary_key_columns, #primary_key_constraints, #referential_constraints, #triggers, #unique_constraints

Attributes inherited from Node

#name, #parent, #root

Instance Method Summary collapse

Methods inherited from Table

#[], #depending_tables, #depending_views, #insertable?, #materialized?, #primary_key_column, #typed?, #view?

Methods inherited from Node

#dump, #dump_value, #guid, #inspect, #sid, #to_s, #to_yaml, #uid

Constructor Details

#initialize(schema, name, is_insertable, is_typed) ⇒ View

Returns a new instance of View.



290
291
292
293
294
# File 'lib/pg_meta/meta.rb', line 290

def initialize(schema, name, is_insertable, is_typed)
  super
  @defining_relations = []
  @defining_tables = []
end

Instance Attribute Details

#defining_relationsObject (readonly)

List of views and tables used directly in the definition of this view



283
284
285
# File 'lib/pg_meta/meta.rb', line 283

def defining_relations
  @defining_relations
end

#defining_tablesObject (readonly)

List of tables used directly or indirectly in the definition of this view



286
287
288
# File 'lib/pg_meta/meta.rb', line 286

def defining_tables
  @defining_tables
end

Instance Method Details

#table?Boolean

Returns:

  • (Boolean)


288
# File 'lib/pg_meta/meta.rb', line 288

def table?() false end

#to_hObject



296
297
298
299
300
301
# File 'lib/pg_meta/meta.rb', line 296

def to_h()
  h = super
  h[:defining_relations] = defining_relations.map(&:uid)
  h[:defining_tables] = defining_tables.map(&:uid)
  h
end