slickext icon indicating copy to clipboard operation
slickext copied to clipboard

The column name generate problem

Open djx314 opened this issue 10 years ago • 4 comments

In https://github.com/jilen/slickext/blob/6ff01a971f63f0e4ff24657025d62be96a894312/src/main/scala/slick/ext/macros/table.scala#L137

use

"([a-z\\d])([A-Z])".r.replaceAllIn(name, "$1_$2").toLowerCase()

property "ChannelID" generate to column name "channel_id"

and use

"(?<!^)([A-Z\\d])".r.replaceAllIn(name, "_$1").toLowerCase()

the result is "channel_i_d"

so I think the old code is better.

djx314 avatar Apr 29 '15 16:04 djx314

This is hard to say which is better... Maybe we need a custom function for mapping table name

jilen avatar May 06 '15 00:05 jilen

Perhaps we can see some code generate way in hibernate, ebean and so on.

djx314 avatar May 06 '15 02:05 djx314

@djx314 I decide to provide ability to custom naming strategy after Chinese new year

jilen avatar Feb 05 '16 15:02 jilen

Great!

djx314 avatar Feb 06 '16 06:02 djx314