[Dbix-class] is_foreign_key_constraint => false is ineffective
Matt S Trout
dbix-class at trout.me.uk
Tue Nov 6 14:11:36 GMT 2007
On Sat, Nov 03, 2007 at 08:52:45PM +0000, Matt S Trout wrote:
> On Fri, Nov 02, 2007 at 04:35:14PM +1030, Jon Schutz wrote:
> > I've added is_foreign_key_constraint => 0 as an attribute in a
> > relationship, in order to query across the join without imposing
> > database level constraints - but the constraint is still appearing in
> > the resulting schema.
>
> Use an explicit join condition and wrap it in [] to stop FK creation -
>
> __PACKAGE__->belongs_to(
> 'foo', 'Schema::Foo', [ { 'foreign.id' => 'self.foo_id' } ]
> );
Replying to myself, you'd actually need to use add_relationship - there's
a bug in belongs_to where it doesn't currently recognise an arrayref join
cond; this is fixed in trunk.
--
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director http://www.shadowcat.co.uk/catalyst/
Shadowcat Systems Ltd. Want a managed development or deployment platform?
http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/
More information about the DBIx-Class
mailing list