[Dbix-class] add_unique_constraint

Ascii King tech at swattermatter.com
Wed Jun 3 12:57:40 GMT 2009


I am a rookie programmer trying to set up a web database. I am having 
trouble understanding how to get the add_unique_constraint working. I am 
using Catalyst and FormFu and I cannot get the method working as i 
expect. I added the following line to my Schema file:

# Created by DBIx::Class::Schema::Loader v0.04004 @ 2009-05-14 10:18:31
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5sD0bi0DMi9SwUz0z7Jt7A

__PACKAGE__->add_unique_constraint(username => [ qw/username/ ]);


But, it does not seem to affect my code at all.  I would like each 
username to be unique in the system and prevent dupklicates from being 
entered. i am using both an SQLite3 database and a separate instance on 
a MS SQL Server.

The only change I have made to my code is this one line, though I tried 
several different examples I found on the web.



More information about the DBIx-Class mailing list