On Sun, Oct 3, 2010 at 12:43 AM, Peter Rabbitson
<[email protected]<rabbit%[email protected]>
> wrote:

> Bill Moseley wrote:
>
>> I'm wondering if find_or_create should throw an exception if a unique
>> constraint does not exist or if the values passed to find_or_create do not
>> include ALL the columns in the constraint.
>>
>
> DBIx::Class is a tool, it does not enforce "design cleanliness". Heck it
> even works with pk-less tables if need be, there is a ton of crappy
> preexisting schemas out there. To get what you want simply turn on
> FATAL warnings and perl will DTRT :)
>

Well, I wish the code for our products was that clean, but it's just not
there yet.  Living with some warnings is different than a database that is
not updated as expected, though.


But, limiting the discussion to what someone using DBIC might expect, and
how DBIC might help them, if one does this:

__PACKAGE->add_unique_constraint( name => [qw/ one two three /] );


then:

$rs->find_or_create({
    one => 1,
    two => 2,
    three => 3,
    other => 123,
});


would they not expect that all those columns would be set in the database?




> Btw how is the patch for find_or_create coming along?
>

It has recently moved up a page the jira dashboard.



-- 
Bill Moseley
[email protected]
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]

Reply via email to