slick-pg icon indicating copy to clipboard operation
slick-pg copied to clipboard

Adding sql comments into slick generated sql

Open binshi opened this issue 6 years ago • 2 comments

Is there a way I can add comments into the sql that is formed by slick without writing a raw sql statement? This is to keep track of the code in application that launched the sql.

binshi avatar Dec 04 '18 18:12 binshi

Here's some codes about table/columns' definition:

...
    class A(tag: Tag) extends Table[(Int, String, String)](tag, "A") {
      def id = column[Int]("ID", O.PrimaryKey, O.AutoInc)
      def s1 = column[String]("S1")
      def s2 = column[String]("S2")
      def * = (id, s1, s2)
    }
...

def column[C](n: String, options: ColumnOption[C]*)(implicit tt: TypedType[C]): Rep[C] = {
...
  trait ColumnOptions {
    val PrimaryKey = ColumnOption.PrimaryKey
    def Default[T](defaultValue: T) = RelationalProfile.ColumnOption.Default[T](defaultValue)
    val AutoInc = ColumnOption.AutoInc
    val Unique = ColumnOption.Unique
    val Length = RelationalProfile.ColumnOption.Length
  }

  val columnOptions: ColumnOptions = new ColumnOptions {}

I didn't find it.

tminglei avatar Dec 05 '18 01:12 tminglei

FYI: Here's a related issue: https://github.com/slick/slick/issues/468

vanDonselaar avatar Dec 05 '18 07:12 vanDonselaar