change usage of Tie::IxHash
[dbsrgits/SQL-Translator-2.0-ish.git] / lib / SQL / Translator / Object / Index.pm
index 4fad2fe..f5729a0 100644 (file)
@@ -2,7 +2,8 @@ use MooseX::Declare;
 class SQL::Translator::Object::Index extends SQL::Translator::Object {
     use MooseX::Types::Moose qw(HashRef Str);
     use MooseX::MultiMethods;
-    use SQL::Translator::Types qw(Column Table);
+    use SQL::Translator::Types qw(Column Table ColumnHash IxHash);
+    use Tie::IxHash;
 
     has 'table' => (
         is => 'rw',
@@ -17,18 +18,19 @@ class SQL::Translator::Object::Index extends SQL::Translator::Object {
     );
 
     has 'columns' => (
-        traits => ['Hash'],
         is => 'rw',
-        isa => HashRef[Column],
+        isa => IxHash, #ColumnHash,
         handles => {
-            exists_column => 'exists',
-            column_ids    => 'keys',
-            get_columns   => 'values',
-            get_column    => 'get',
-            add_column    => 'set',
-            clear_columns => 'clear',
+            exists_column => 'EXISTS',
+            column_ids    => 'Keys',
+            get_columns   => 'Values',
+            get_column    => 'FETCH',
+            add_column    => 'STORE',
+            remove_column => 'DELETE',
+            clear_columns => 'CLEAR',
         },
-        default => sub { my %hash = (); tie %hash, 'Tie::IxHash'; return \%hash },
+        coerce => 1,
+        default => sub { Tie::IxHash->new() }
     );
 
     has 'type' => (