Is it possible to force liftweb mapper use table name in lower case for querying models?
+3
A:
You can override dbTableName in your MetaMapper
object ModelClass extends ModelClass with LongKeyedMetaMapper {
override def dbTableName = "model_class"
}
jgoday
2010-08-12 13:01:35
+2
A:
If you want a uniform way of generating your table and column names, you should set the MapperRules.{tableName,columnName} PartialFunctions. So, if you want all of your tables and columns to be snake case, include the following two lines in your Boot.scala file:
MapperRules.tableName = (_, name) => StringHelpers.snakify(name)
MapperRules.columnName = (_, name) => StringHelpers.snakify(name)
This avoids the extraneous boilerplate of overriding the dbTableName on each class.
Aaron
2010-08-17 01:57:15
Excellent answer.
David Pollak
2010-08-24 12:47:47