Class: Mkxms::Mssql::UniqueConstraintHandler
- Inherits:
-
Object
- Object
- Mkxms::Mssql::UniqueConstraintHandler
- Defined in:
- lib/mkxms/mssql/unique_constraint_handler.rb
Instance Method Summary collapse
- #handle_column_element(parse) ⇒ Object
-
#initialize(constraints, node) ⇒ UniqueConstraintHandler
constructor
A new instance of UniqueConstraintHandler.
Constructor Details
#initialize(constraints, node) ⇒ UniqueConstraintHandler
Returns a new instance of UniqueConstraintHandler.
15 16 17 18 19 20 21 |
# File 'lib/mkxms/mssql/unique_constraint_handler.rb', line 15 def initialize(constraints, node) a = node.attributes @uconst = UniqueConstraint.new(a).tap do |c| constraints << c end end |
Instance Method Details
#handle_column_element(parse) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/mkxms/mssql/unique_constraint_handler.rb', line 23 def handle_column_element(parse) a = parse.node.attributes raise UnsupportedFeatureError.new("Unique constraints may not specify included columns (#{@uconst.qualified_table})") if a['included'] @uconst.columns << IndexColumn.new(a['name'], a['desc'] ? :descending : :ascending) end |