From: John Napiorkowski Date: Fri, 30 May 2008 16:37:56 +0000 (+0000) Subject: reverted unneeded change to field name in Treelike.pm to parent from parent_fk, updat... X-Git-Tag: v0.08240~402^2~28 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=61177e4410737d15901ed2f25d3fe5ea99d525ad;p=dbsrgits%2FDBIx-Class.git reverted unneeded change to field name in Treelike.pm to parent from parent_fk, updated all underlying tests and related bits as requested by Castaway. --- diff --git a/t/86sqlt.t b/t/86sqlt.t index a83e413..912eb61 100644 --- a/t/86sqlt.t +++ b/t/86sqlt.t @@ -153,9 +153,9 @@ my %fk_constraints = ( treelike => [ { 'display' => 'treelike->treelike for parent', - 'name' => 'treelike_fk_parent_fk', 'index_name' => 'treelike_idx_parent_fk', + 'name' => 'treelike_fk_parent', 'index_name' => 'treelike_idx_parent', 'selftable' => 'treelike', 'foreigntable' => 'treelike', - 'selfcols' => ['parent_fk'], 'foreigncols' => ['id'], + 'selfcols' => ['parent'], 'foreigncols' => ['id'], on_delete => 'CASCADE', on_update => 'CASCADE', deferrable => 1, }, ], diff --git a/t/lib/DBICTest.pm b/t/lib/DBICTest.pm index 8252ecc..aea28e1 100755 --- a/t/lib/DBICTest.pm +++ b/t/lib/DBICTest.pm @@ -229,7 +229,7 @@ sub populate_schema { ]); $schema->populate('TreeLike', [ - [ qw/id parent_fk name/ ], + [ qw/id parent name/ ], [ 1, undef, 'root' ], [ 2, 1, 'foo' ], [ 3, 2, 'bar' ], diff --git a/t/lib/DBICTest/Schema/TreeLike.pm b/t/lib/DBICTest/Schema/TreeLike.pm index c124241..8f24102 100644 --- a/t/lib/DBICTest/Schema/TreeLike.pm +++ b/t/lib/DBICTest/Schema/TreeLike.pm @@ -6,15 +6,15 @@ use base qw/DBIx::Class::Core/; __PACKAGE__->table('treelike'); __PACKAGE__->add_columns( 'id' => { data_type => 'integer', is_auto_increment => 1 }, - 'parent_fk' => { data_type => 'integer' , is_nullable=>1}, + 'parent' => { data_type => 'integer' , is_nullable=>1}, 'name' => { data_type => 'varchar', size => 100, }, ); __PACKAGE__->set_primary_key(qw/id/); __PACKAGE__->belongs_to('parent', 'TreeLike', - { 'foreign.id' => 'self.parent_fk' }); -__PACKAGE__->has_many('children', 'TreeLike', { 'foreign.parent_fk' => 'self.id' }); + { 'foreign.id' => 'self.parent' }); +__PACKAGE__->has_many('children', 'TreeLike', { 'foreign.parent' => 'self.id' }); ## since this is a self referential table we need to do a post deploy hook and get ## some data in while constraints are off diff --git a/t/lib/sqlite.sql b/t/lib/sqlite.sql index 828c85a..3ec9cfd 100644 --- a/t/lib/sqlite.sql +++ b/t/lib/sqlite.sql @@ -151,7 +151,7 @@ CREATE TABLE tags ( -- CREATE TABLE treelike ( id INTEGER PRIMARY KEY NOT NULL, - parent_fk integer NULL, + parent integer NULL, name varchar(100) NOT NULL );