Class: PgMeta::ReferentialConstraint

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

Instance Attribute Summary collapse

Attributes inherited from Constraint

#columns

Attributes inherited from Node

#name, #parent, #root

Instance Method Summary collapse

Methods inherited from Constraint

#column, #kind

Methods inherited from Node

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

Constructor Details

#initialize(referencing_table, name, referencing_columns, referenced_constraint) ⇒ ReferentialConstraint

Returns a new instance of ReferentialConstraint.



509
510
511
512
513
# File 'lib/pg_meta/meta.rb', line 509

def initialize(referencing_table, name, referencing_columns, referenced_constraint)
  super(referencing_table, name, referencing_columns)
  @referenced_constraint = referenced_constraint
  table.referential_constraints[name] = self
end

Instance Attribute Details

#referenced_constraintObject (readonly)

The referenced constraint



501
502
503
# File 'lib/pg_meta/meta.rb', line 501

def referenced_constraint
  @referenced_constraint
end

Instance Method Details

#referenced_columnsObject

The referenced columns



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

def referenced_columns() referenced_constraint.columns end

#referenced_tableObject

The referenced table



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

def referenced_table() referenced_constraint.table end

#to_hObject



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

def to_h() attrs_to_h(:name, :kind, :referencing_columns, :referenced_constraint) end