Class: Straitjacket::DeprecatedConstraint

Inherits:
Constraint
  • Object
show all
Defined in:
lib/straitjacket.rb

Instance Attribute Summary

Attributes inherited from Constraint

#column, #content, #name, #options, #table

Instance Method Summary collapse

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

#sqlObject



104
105
106
# File 'lib/straitjacket.rb', line 104

def sql
  %[ALTER TABLE "#{table}" DROP CONSTRAINT "#{name}"]
end