Anyone? Why isn't IdPK telling Schemifier to create the id column as a unique 
primary key, and how can I get it to?

-------------------------------------
Naftoli Gugenhem<[email protected]> wrote:

I just found the INFORMATION_SCHEMA.INDEXES table. It clearly says that all my 
id's are non-unique, non primary key. I'm mixing in IdPK. What am I doing wrong?

-------------------------------------
Tim Nelson<[email protected]> wrote:

H2 has a great console servlet that you can use to connect to any jdbc
compliant database and I just figured out how to configure it to work with
lift.

Assuming you already have H2 as a dependency, just add a mapping to the
servlet in your web.xml. Mine looks like this:

<web-app>

  <filter>
    <filter-name>LiftFilter</filter-name>
    <display-name>Lift Filter</display-name>
    <description>The Filter that intercepts lift calls</description>
    <filter-class>net.liftweb.http.LiftFilter</filter-class>
  </filter>

  <filter-mapping>
    <filter-name>LiftFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

  <servlet>
    <servlet-name>H2Console</servlet-name>
    <servlet-class>org.h2.server.web.WebServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>H2Console</servlet-name>
    <url-pattern>/console/*</url-pattern>
  </servlet-mapping>

</web-app>

Then you need to add a rule to LiftRules.liftRequest using the following
line in boot:

LiftRules.liftRequest.append({case r if (r.path.partPath match {case
"console" :: _ => true case _ => false}) => false})

That basically allows all requests that start with "console" to be ignored
by lift and passed thru to the servlet.

I am actually using PostgreSQL, but I prefer using this to pgAdmin or other
SQL tools.

Tim


On Fri, Jul 3, 2009 at 3:25 PM, Naftoli Gugenheim <[email protected]>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 <
> [email protected]> 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<[email protected]> 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 <[email protected]> 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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to