[Catalyst] Using Catalyst on MS SQL DB that has tables with no primary keys

Robert Wohlfarth rbwohlfarth at gmail.com
Fri Sep 14 18:40:02 GMT 2012


On Fri, Sep 14, 2012 at 1:31 PM, Derek W <derekwrobel at gmail.com> wrote:

> Thanks, I figured that would probably fix it, but the problem is I am
> not allowed to make any changes to the DB structure itself.  I suppose
> I need to convince them why it's in the best interest to have a
> primary key...
>
>
You can set the primary key in the schema file. For example, add a
line like __PACKAGE__->set_primary_key(
"id" ); to lib/MyApp/Schema/Result/MyTable.pm. You do not need to change
the database. DBIx::Class will then use *id* whenever it wants a primary
key.

-- =

Robert Wohlfarth
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20120914/3d13c=
95d/attachment.htm


More information about the Catalyst mailing list