Test::Fixture::DBIC::Schema
ãDBå¨ãã®ãã¸ãã¯ãã¹ãããããã¦å°å ¥ãã¦ã¿ãã®ã§ããããªã¬ã¼ã·ã§ã³ããã¿ã§create_relatedã¡ã½ãããªããã使ã£ã¦ãã¨ãcreateæã«ã³ã±ã¦ãã¾ãã®ã§ã
--- Schema.pm 2008-05-10 14:39:59.000000000 +0900 +++ Schema.pm.new 2009-02-27 16:28:24.000000000 +0900 @@ -71,8 +71,7 @@ my $result = {}; for my $row ( @{ $fixture } ) { - $schema->resultset( $row->{schema} )->create( $row->{data} ); - $result->{ $row->{name} } = $schema->resultset( $row->{schema} )->find( $row->{data} ); + $result->{ $row->{name} } = $schema->resultset( $row->{schema} )->update_or_create( $row->{data} ); } return $result; }
ãããããæ¹ãããããªãã¨æãã¾ããããã¨ãæ¿å
¥ã¡ã½ããã®è¿ãå¤ãå©ç¨ãã¦SQLã®çºè¡ãååã«æããã°ãããã©ã¼ãã³ã¹ãå°ãä¸ããã®ã§ã¯ãªããã¨ã
ãã«ãã¦ãããã¹ãç¨ããã¼ãã¼ã¿ã®ä½æã¯ãã³ãã«ç²ããâ¦ã
ï¼è¿½è¨ï¼
ããµã¨æã£ã¦DBIx::MoCo::Fixtureãè¦ã¦ã¿ãããäºæ³éãåãåé¡ãæ±ãã¦ãâ¦
ããã¼ã¿ãå
¥ããä»çµã¿ãéãã®ã§ãåãåé¡ã¯èµ·ãããã¾ããã