[jifty-devel] additional SQL constraints?

Thomas Sibley trs at bestpractical.com
Fri Oct 1 15:22:56 EDT 2010


On 28 Sep 2010 17:00, Matt Zagrabelny wrote:
> Hmmm. That doesn't seem quite logical. I could have a unique
> constraint for each column individually or the *combination* of
> multiple columns.

Jifty only handles the first case with the syntax I mentioned before.
If you want the second case, you'll need to tweak the DB and write a
custom validation routine in your Widgets model to check for the unique
pair.

Thomas

> For instance:
> 
> CREATE TABLE widgets (
>   name TEXT,
>   model_number TEXT,
> 
>   UNIQUE(name),
>   UNIQUE(model_number)
> );
> 
> is very different from:
> 
> CREATE TABLE widgets (
>   name TEXT,
>   model_number TEXT,
> 
>   UNIQUE(name, model_number)
> );
> 
> How does jifty handle the above difference?
> 
> or do you manually tweak the DB?
> 
> Thanks,
> 
> -matt zagrabelny
> _______________________________________________
> jifty-devel mailing list
> jifty-devel at lists.jifty.org
> http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel



More information about the jifty-devel mailing list