We don't have the constraints at the time of constructing Schema. How we
could instantiate constraints afterwards?


On Tue, Mar 12, 2013 at 4:38 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
>
> case class Schema(table: String, columns: immutable.Seq[Column],
> constraints: immutable.Set[Constraint]) ?
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/slick/slick/pull/112/files#r3337095>
> .
>



-- 
Amir Shaikhha