Should have removed constraint, not index. Duh. master
moltar [Tue, 14 May 2013 21:11:37 +0000 (17:11 -0400)]
lib/DBIx/Class/Tree/AdjacencyList.pm

index 4925416..a77eeda 100644 (file)
@@ -368,15 +368,16 @@ __END__
 
 If you are using L<DBIx::Class::Schema/deploy> methods either directly
 or via L<DBIx::Class::DeploymentHandler> or L<DBIx::Migration>, you
-will need the following L<SQL::Translator> hook to remove the index
-from C<parent_column>.
+will need the following L<SQL::Translator> hook to remove the constraint
+from C<parent_column>, otherwise you will not be able to user 0 (zero) as
+a value.
 
   sub sqlt_deploy_hook {
       my ($self, $sqlt_table) = @_;
 
-      foreach my $index ($sqlt_table->get_indices) {
-          if ($index->fields->[0] eq $self->parent_column) {
-              $sqlt_table->drop_index($index->name);
+      foreach my $constraint ($sqlt_table->get_constraints) {
+          if ($constraint->field_names->[0] eq $self->parent_column) {
+              $sqlt_table->drop_constraint($constraint->name);
               last;
           }
       }