Is it possible to force liftweb map开发者_高级运维per use table name in lower case for querying models?
You can override dbTableName in your MetaMapper
object ModelClass extends ModelClass with LongKeyedMetaMapper {
override def dbTableName = "model_class"
}
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.
精彩评论