fixed test resultclass formatting, added a few more DBIC::Storage::DBI methods that...
[dbsrgits/DBIx-Class-Historic.git] / t / lib / DBICTest / Schema / TreeLike.pm
CommitLineData
c6d74d3e 1package # hide from PAUSE
2 DBICTest::Schema::TreeLike;
38a0b4ff 3
660cf1be 4use base qw/DBICTest::BaseResult/;
38a0b4ff 5
6__PACKAGE__->table('treelike');
7__PACKAGE__->add_columns(
8 'id' => { data_type => 'integer', is_auto_increment => 1 },
61177e44 9 'parent' => { data_type => 'integer' , is_nullable=>1},
cb561d1a 10 'name' => { data_type => 'varchar',
11 size => 100,
12 },
38a0b4ff 13);
14__PACKAGE__->set_primary_key(qw/id/);
5db49b9a 15__PACKAGE__->belongs_to('parent', 'TreeLike',
61177e44 16 { 'foreign.id' => 'self.parent' });
17__PACKAGE__->has_many('children', 'TreeLike', { 'foreign.parent' => 'self.id' });
38a0b4ff 18
89cf6a70 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
21
22 sub sqlt_deploy_hook {
23 my ($self, $sqlt_table) = @_;
24
64cdad22 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']);
89cf6a70 27 }
38a0b4ff 281;