H2 not getting primary keys created
Run the following code
The output is:
INFO - CREATE TABLE m (field VARCHAR(10) , id BIGINT NOT NULL AUTO_INCREMENT)
INFO - CREATE INDEX m_id ON m ( id )
<pre>
import _root_.net.liftweb.util._
import Helpers._
import _root_.java.sql.{Connection, DriverManager}
class M extends LongKeyedMapper[M] with IdPK {
def getSingleton = M
object field extends MappedString(this, 10)
}
object M extends M with LongKeyedMetaMapper[M]
object H2TestCase {
def main(args: Array[String]) {
DB.defineConnectionManager(DefaultConnectionIdentifier, new ConnectionManager {
def newConnection(name: ConnectionIdentifier): Box[Connection] = {
Class.forName("org.h2.Driver")
Full(DriverManager.getConnection("jdbc:h2:mem:lift;DB_CLOSE_DELAY=-1"))
}
def releaseConnection(conn: Connection) {
try {
conn.close
} catch {
case e => Empty //ignore
}
}
})
Schemifier.schemify(true, Log.infoF _, M)
}
}
</pre>
The output is:
INFO - CREATE TABLE m (field VARCHAR(10) , id BIGINT NOT NULL AUTO_INCREMENT)
INFO - CREATE INDEX m_id ON m ( id )
Leave a comment
on 2010-02-06 19:47 *
By github.importer
Imported from GitHub: http://github.com/dpp/liftweb/issues/48/find