Nice idea! Thanks a lot :)


On Tue, Mar 12, 2013 at 6:25 PM, Viktor Klang (√)
<notifications@github.com>wrote:

> In src/main/scala/scala/slick/typeProviders/Model.scala:
>
> > +import scala.collection.mutable.ArrayBuffer
> > +
> > +case class Schema(table: String, columns: List[Column]){
> > +  import Column._
> > +
> > +  val scalaName = Naming.tableSQLToModule(table)
> > +
> > +  val caseClassName = Naming.moduleToCaseClass(scalaName)
> > +
> > +  def primaryKeys: List[Column] = constraints.collect{case pk: Column.PrimaryKey => pk.fields}.headOption.getOrElse(Nil)
> > +
> > +  def foreignKeys: List[ForeignKey] = constraints.collect{case fk: Column.ForeignKey => fk}
> > +
> > +  def constraints: List[Constraint] = _constraints.toList
> > +
> > +  private var _constraints: ArrayBuffer[Constraint] = new ArrayBuffer
>
> You replace it with a copy with the constraints. schema.copy(constraints =
> determineConstraintsFor(schema))
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/slick/slick/pull/112/files#r3339259>
> .
>



-- 
Amir Shaikhha