[Dbix-class] add_unique_constraint

David Ihnen davidi at norchemlab.com
Wed Jun 3 16:52:25 GMT 2009


I can't say I know anything of Catalyst or FormFu, but I do know about 
web applications and database integrations.  What exactly do you mean by 
"a web database"?  Usually people are trying to create some sort of 
content delivery system on the web, which utilizes a database for data 
storage.  That is, the object in question is not specifically a database 
- it is the application that delivers information that is really being 
created.

Perhaps if you could give an example of the result you are getting 
versus the result you expect, it would be more clear exactly what you're 
asking.  Perhaps it is doing what its supposed to but that is not what 
you expect.

In my experience constraints are database side things more than 
DBIx::Class things, but you're using the Schema Loader, which is yet 
another specific I don't have personal experience with.  I know thats 
supposed to bridge the gap in some way.

David


Ascii King wrote:
> 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.
>
> _______________________________________________
> 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/dbix-class@lists.scsys.co.uk
>




More information about the DBIx-Class mailing list