I looked into this a little bit. The relevant chunks of code seem to
be Schemifier.scala, lines 163 and 207, where
connection.driverType.pkDefinedByIndexColumn_? is checked before using
an ALTER TABLE to set a primary key, and Driver.scala, line 131, where
the H2Driver has pkDefinedByIndexColumn_?
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 wrote:
I just found the INFORMATION_SCHEMA.INDEXES table. It clearly says that all my
id's are non-unique, non primary key.
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 wrote:
H2 has a great console servlet that you can use to connect to any jdbc
complian
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 bot
The console is basically a text box for executing SQL. But how can I tell if my
IDs are PKs? I inserted some rows exported from MySQL containing ids and ended
up with a duplicate id of something I already had. So what went wrong? Lift
generated the tables from my Mapper.
--
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:
LiftFilter
Li
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 kno
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,
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 wrote:
> Does lift have any way to specify a unique constraint on a field, via
> schemify (or validation)?
> If not, how complex would