]>
Dogcows Code - chaz/p5-DBIx-Class-ResultSet-RecursiveUpdate/blob - t/lib/DBICTest/Schema/TreeLike.pm
1 package # hide from PAUSE
2 DBICTest
::Schema
::TreeLike
;
4 use base qw
/DBIx::Class::Core/;
6 __PACKAGE__-
>table('treelike');
7 __PACKAGE__-
>add_columns(
8 'id' => { data_type
=> 'integer', is_auto_increment
=> 1 },
9 'parent' => { data_type
=> 'integer' , is_nullable
=>1},
10 'name' => { data_type
=> 'varchar',
14 __PACKAGE__-
>set_primary_key(qw
/id/);
15 __PACKAGE__-
>belongs_to('parent', 'TreeLike',
16 { 'foreign.id' => 'self.parent' });
17 __PACKAGE__-
>has_many('children', 'TreeLike', { 'foreign.parent' => 'self.id' });
19 ## since this is a self referential table we need to do a post deploy hook and get
20 ## some data in while constraints are off
22 sub sqlt_deploy_hook
{
23 my ($self, $sqlt_table) = @_;
25 ## We don't seem to need this anymore, but keeping it for the moment
26 ## $sqlt_table->add_index(name => 'idx_name', fields => ['name']);
This page took 0.032744 seconds and 4 git commands to generate.