Class: Straitjacket::ForeignKeyConstraint
- Inherits:
-
Constraint
- Object
- Constraint
- Straitjacket::ForeignKeyConstraint
- Defined in:
- lib/straitjacket.rb
Instance Attribute Summary
Attributes inherited from Constraint
#column, #content, #name, #options, #table
Instance Method Summary collapse
Methods inherited from Constraint
Constructor Details
This class inherits a constructor from Straitjacket::Constraint
Instance Method Details
#sql ⇒ Object
116 117 118 119 120 121 122 123 |
# File 'lib/straitjacket.rb', line 116 def sql more = "" if [:references] on = [:on] ? %[("#{[:on]}")] : "" more = %[REFERENCES "#{[:references]}"#{on}] end %[ALTER TABLE "#{table}" ADD CONSTRAINT "#{name}" FOREIGN KEY ("#{column}") #{more} MATCH FULL] end |