[Catalyst] Loader and circular references

Marcello m.romani at spinsoft.it
Tue Jul 5 08:43:20 CEST 2005


Zbyszek Lukasiak ha scritto:
> Dear all,
> 
> I have circular foreign key references in my tables.  I attache the DDL for
> those tables below.  When I start catalyst I get lots of warning of the
> format:
> jobs method already exists in LinkDB::M::CDBI::Opinion
>  at /usr/local/share/perl/5.8.4/Class/DBI/Relationship/HasMany.pm line 13
> links method already exists in LinkDB::M::CDBI::Usr
>  at /usr/local/share/perl/5.8.4/Class/DBI/Relationship/HasMany.pm line 13
> opinions method already exists in LinkDB::M::CDBI::Link
>  at /usr/local/share/perl/5.8.4/Class/DBI/Relationship/HasMany.pm line 13
> opinions method already exists in LinkDB::M::CDBI::Usr
> ...
> 
> I am not sure if the circular foreign keys don't break some Relational 
> Database best practices, but still this seems like a bug in the Loader. 
> 
> -- Zbigniew Lukasiak

This is not  a bug in Catalyst, but rather a problem in Class::DBI::Loader.
Whenever you feel Loader can't handle something about you schema,
try to setup your CDBI classes by hand.

Marcello

> 
> =========================================
> create table job(
> id serial primary key,
> cdate timestamp default CURRENT_TIMESTAMP,
> addtags text,
> startopinion integer,
> maxdistance integer
> );
> 
> create table opinion(
> id serial primary key,
> link integer,
> usr integer,
> name text,
> flag char (1),
> cdate timestamp,
> namevect tsvector,
> tags text,
> tagsvect tsvector,
> origin char(1),
> distance integer,
> job integer,
> foreign key (job) references job(id) ON DELETE CASCADE,
> foreign key (link) references link(id) ON DELETE CASCADE,
> foreign key (usr) references usr(id) ON DELETE CASCADE
> );
> alter table job add foreign key(startopinion) references opinion(id) on delete cascade;
> 
> 
> 
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst
> 




More information about the Catalyst mailing list