From: moltar Date: Tue, 14 May 2013 21:01:02 +0000 (-0400) Subject: Added doc caveat about schema generators. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e73533529860dee98c0b3852e78422e18c38d644;p=dbsrgits%2FDBIx-Class-Tree.git Added doc caveat about schema generators. --- diff --git a/lib/DBIx/Class/Tree/AdjacencyList.pm b/lib/DBIx/Class/Tree/AdjacencyList.pm index e14875f..4925416 100644 --- a/lib/DBIx/Class/Tree/AdjacencyList.pm +++ b/lib/DBIx/Class/Tree/AdjacencyList.pm @@ -66,7 +66,7 @@ stop you from having multiple root nodes. __PACKAGE__->parent_column('parent_id'); Declares the name of the column that contains the self-referential -ID which defines the parent row. This will create a has_many (children) +ID which defines the parent row. This will create a has_many (children) and belongs_to (parent) relationship. This method also sets up an additional has_many relationship called @@ -362,6 +362,29 @@ sub set_primary_key { 1; __END__ +=head1 CAVEATS + +=head2 Generated schemas + +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. + + 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); + last; + } + } + } + +ALso see L for other examples. + =head1 INHERITED METHODS =head2 DBIx::Class