Class: PgMeta::ReferentialConstraint
- Inherits:
-
Constraint
- Object
- Node
- Constraint
- PgMeta::ReferentialConstraint
- Defined in:
- lib/pg_meta/meta.rb
Instance Attribute Summary collapse
-
#referenced_constraint ⇒ Object
readonly
The referenced constraint.
Attributes inherited from Constraint
Attributes inherited from Node
Instance Method Summary collapse
-
#initialize(referencing_table, name, referencing_columns, referenced_constraint) ⇒ ReferentialConstraint
constructor
A new instance of ReferentialConstraint.
-
#referenced_columns ⇒ Object
The referenced columns.
-
#referenced_table ⇒ Object
The referenced table.
- #to_h ⇒ Object
Methods inherited from Constraint
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_constraint ⇒ Object (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_columns ⇒ Object
The referenced columns
507 |
# File 'lib/pg_meta/meta.rb', line 507 def referenced_columns() referenced_constraint.columns end |
#referenced_table ⇒ Object
The referenced table
504 |
# File 'lib/pg_meta/meta.rb', line 504 def referenced_table() referenced_constraint.table end |
#to_h ⇒ Object
515 |
# File 'lib/pg_meta/meta.rb', line 515 def to_h() attrs_to_h(:name, :kind, :referencing_columns, :referenced_constraint) end |