Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get default value of column in Slick?

Is there an easy way to do this? I got lost wading around in the source trying to find some code that would do this.

like image 982
Kevin Li Avatar asked Feb 02 '26 05:02

Kevin Li


1 Answers

Slick's table component provides additional column options. This is accesable via an object O.

So to get a default value specified for the column, you could do something like this:

def mycolumn = column[String](
       "MYCOLUMNNAME",
       O.DBType("VARCHAR"),
       O.Default("Let's eat icecream"))
like image 199
Jack Avatar answered Feb 03 '26 22:02

Jack