[Dbix-class] DBIx::Class::Schema::Loader - unique_constraints?

Brandon Black blblack at gmail.com
Mon Mar 6 14:58:53 CET 2006


On 3/6/06, Adam Sjøgren <asjo at koldfront.dk> wrote:
> On Mon, 06 Mar 2006 13:08:18 +0100, Adam wrote:
>
> > Is DBIx::Class::Schema::Loader supposed to figure out the
> > unique_constraints by itself, or should I configure them somehow?
>
> I can make it work by calling:
>
>  __PACKAGE__->source('MyTable')->add_unique_constraint(unique=>[qw(field1 field2)]);
>
> after the call to ->load_from_connection (in my Schema-class that
> inherits from D:C:Schema::Loader).
>
> From the "outside" it looks like it should be possible to ask
> PostgreSQL to provide this information so that Schema::Loader could
> add the unique_constraints automatically, but perhaps it isn't that
> easy?
>

It can be done, it just hasn't been done yet.  It's on the List :)

-- Brandon



More information about the Dbix-class mailing list