[Dbix-class] add_unique_constraint syntax generated by DBIx::Class::Schema::Loader

Dave Howorth dhoworth at mrc-lmb.cam.ac.uk
Tue May 18 14:50:23 GMT 2010


I'm trying to understand the files generated by Loader, which I've
generated from an existing database. In many cases, the syntax generated
for calls to add_unique_constraint() don't match that in any
documentation I've found and I don't understand it when reading the
implementation of add_unique_constraint either. Here's an example file:

package TDB::Schema::Functions;

# Created by DBIx::Class::Schema::Loader v0.03000 @ 2010-05-18 14:52:15

use strict;
use warnings;

use base 'DBIx::Class';

__PACKAGE__->load_components("PK::Auto", "Core");
__PACKAGE__->table("functions");
__PACKAGE__->add_columns("func", "description");
__PACKAGE__->set_primary_key("func");
__PACKAGE__->add_unique_constraint(["func"], undef);

1;

I don't understand that trailing undef. All the docs I've seen have the
list of columns as the last argument.

Cheers, Dave



More information about the DBIx-Class mailing list