Class: DbAgile::Core::Schema::Logical::Constraints

Inherits:
Composite show all
Defined in:
lib/dbagile/core/schema/logical/constraints.rb

Instance Attribute Summary

Attributes inherited from SchemaObject

#parent, #status

Instance Method Summary collapse

Methods inherited from Composite

#[], #[]=, #dependencies, #dup, #each_part, #empty?, #initialize, #look_same_as?, #part_keys, #parts, #size, #to_yaml, #visit, #yaml_display

Methods inherited from SchemaObject

#ancestors, #attribute?, #builder_args, #builder_handler, #candidate_key?, #composite?, #constraint?, #foreign_key?, #index?, #logical?, #outside_dependencies, #outside_dependents, #part?, #physical?, #primary_key?, #relation_variable, #relvar?, #relview?, #schema

Constructor Details

This class inherits a constructor from DbAgile::Core::Schema::Composite

Instance Method Details

#constraint_by_name(name) ⇒ Object

Returns a constraint by name



16
17
18
# File 'lib/dbagile/core/schema/logical/constraints.rb', line 16

def constraint_by_name(name)
  self[name]
end

#primary_keyObject

Returns the primary key



8
9
10
11
12
13
# File 'lib/dbagile/core/schema/logical/constraints.rb', line 8

def primary_key
  each_part{|c|
    return c if c.kind_of?(Logical::CandidateKey) and c.primary?
  }
  nil
end

#to_sObject



20
21
22
# File 'lib/dbagile/core/schema/logical/constraints.rb', line 20

def to_s
  "Constraints of #{relation_variable.name}"
end