X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class-Tree.git;a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FTree%2FAdjacencyList.pm;h=a77eeda0f36f9c0a869bfe02fc9d7ca8cb0c0323;hp=4925416a20b42452ac78c10cbb0d7c491e3ba1f5;hb=f77790db189a9ede148067512fb5b890a316c184;hpb=e73533529860dee98c0b3852e78422e18c38d644 diff --git a/lib/DBIx/Class/Tree/AdjacencyList.pm b/lib/DBIx/Class/Tree/AdjacencyList.pm index 4925416..a77eeda 100644 --- a/lib/DBIx/Class/Tree/AdjacencyList.pm +++ b/lib/DBIx/Class/Tree/AdjacencyList.pm @@ -368,15 +368,16 @@ __END__ If you are using L methods either directly or via L or L, you -will need the following L hook to remove the index -from C. +will need the following L hook to remove the constraint +from C, 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; } }