Class: Straitjacket::DeprecatedConstraint
- Inherits:
-
Constraint
- Object
- Constraint
- Straitjacket::DeprecatedConstraint
- Defined in:
- lib/straitjacket.rb
Instance Attribute Summary
Attributes inherited from Constraint
#column, #content, #name, #options, #table
Instance Method Summary collapse
- #apply(conn) ⇒ Object
-
#initialize(table, name) ⇒ DeprecatedConstraint
constructor
A new instance of DeprecatedConstraint.
- #sql ⇒ Object
Constructor Details
#initialize(table, name) ⇒ DeprecatedConstraint
Returns a new instance of DeprecatedConstraint.
99 100 101 102 |
# File 'lib/straitjacket.rb', line 99 def initialize(table, name) @table = table @name = name end |
Instance Method Details
#apply(conn) ⇒ Object
108 109 110 111 112 |
# File 'lib/straitjacket.rb', line 108 def apply(conn) conn.exec(sql) rescue false end |
#sql ⇒ Object
104 105 106 |
# File 'lib/straitjacket.rb', line 104 def sql %[ALTER TABLE "#{table}" DROP CONSTRAINT "#{name}"] end |