Currently, to create a 2 key index, you do something like:
dbIndexes = Index(IndexedField(foo), IndexedField(bar)) :: Nil

My intention is set it up so doing something like:
dbIndexes = UniqueIndex(IndexedField(foo), IndexedField(bar)) :: Nil

will create a unique index over the combination of both fields.

-Cale


On Fri, Jul 3, 2009 at 4:25 PM, Naftoli Gugenheim<naftoli...@gmail.com> wrote:
> Okay. What about two fields in a unique constraint, e.g. first+last?
> Also, my H2 databased generated by schemifying allowed me to insert rows
> that had duplicate primary keys (or at least they're supposed to be primary
> keys). I'm using LongKeyedMapper ... with IdPK. Am I missing something?
> Anyone know how to read constraints in H2, meaning get it to to tell me what
> constraints/indexes exists?
> Thanks!
>
> On Thu, Jul 2, 2009 at 9:50 AM, Calen Pennington
> <calen.penning...@gmail.com> wrote:
>>
>> I actually had the same question last night. I didn't see the
>> valUnique on mapped string. However, it seems like a better way to do
>> this would be to change the Schemifier::ensureIndexes (line 260 in
>> Schemifier.scala) to do "CREATE UNIQUE INDEX" on request. Is there a
>> known reason why this is hard, or is it just that no one has taken the
>> time to do it yet? If it's the latter (and if I can figure out what's
>> going wrong with my attempts to build lift from source), I hope to
>> take a stab at it in the next day or two.
>>
>> -Cale
>>
>> On Thu, Jul 2, 2009 at 7:21 AM, Joe Wass<j...@folktunefinder.com> wrote:
>> >
>> > Yes for MappedString, valUnique .
>> >
>> >
>> > http://scala-tools.org/scaladocs/liftweb/1.0/net/liftweb/mapper/MappedString.html
>> >
>> > Joe
>> >
>> >
>> >
>> > On Jul 2, 7:55 am, Naftoli Gugenhem <naftoli...@gmail.com> wrote:
>> >> Does lift have any way to specify a unique constraint on a field, via
>> >> schemify (or validation)?
>> >> If not, how complex would it be to implement?
>> >
>> > >
>> >
>>
>>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to