Skip to content

Commit

Permalink
Scala 2.11 compatibility.
Browse files Browse the repository at this point in the history
- Fix Shape.copy type
- Remove val in ColumnExtensionMethods
- Convert \0 to \u0000
- Change TupleClass handling in SlickBackend
- Move ShapeLevel._ types to the top level to avoid diverging implicits
  (https://issues.scala-lang.org/browse/SI-7983). May not be necessary
  any more after M8 (but does no harm in either case).
- Disambiguate PrimaryKey in AbstractSourceCodeGenerator
- Cross-build against Scala 2.10.4 and 2.11.0-RC3
- Provide compatibility for scala/scala#3452
  (implemented by @xeno-by)
- Add testAll command for running test and doctest:test sequentially
  • Loading branch information
szeiger committed Mar 21, 2014
1 parent 9145c81 commit 2dca474
Show file tree
Hide file tree
Showing 21 changed files with 141 additions and 116 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
@@ -1,5 +1,5 @@
language: scala
script: sbt -Dslick.testkit.dbprops=test-dbs/databases.travis.properties test doctest:test
script: sbt -jvm-opts jvmopts.travis -Dslick.testkit.dbprops=test-dbs/databases.travis.properties +testAll
jdk:
- openjdk6
notifications:
Expand Down
7 changes: 7 additions & 0 deletions jvmopts.travis
@@ -0,0 +1,7 @@
-Xmx3076M
-XX:MaxPermSize=1024M
-Xss2M
-XX:+DoEscapeAnalysis
-XX:+UseParallelGC
-XX:+UseCompressedOops
-XX:ReservedCodeCacheSize=128M
16 changes: 13 additions & 3 deletions project/Build.scala
Expand Up @@ -15,9 +15,9 @@ object SlickBuild extends Build {
val repoKind = SettingKey[String]("repo-kind", "Maven repository kind (\"snapshots\" or \"releases\")")

val publishedScalaSettings = Seq(
scalaVersion := "2.10.3",
scalaVersion := "2.10.4",
crossScalaVersions := Seq(scalaVersion.value, "2.11.0-RC3"),
//scalaBinaryVersion <<= scalaVersion,
//crossScalaVersions ++= "2.10.0-M4" :: Nil,
libraryDependencies <+= scalaVersion("org.scala-lang" % "scala-compiler" % _ % "optional")
)

Expand Down Expand Up @@ -104,13 +104,23 @@ object SlickBuild extends Build {
</scm>
) ++ scalaSettings

/* A command that runs 'testkit/test:test' and 'testkit/doctest:test' sequentially */
def testAll = Command.command("testAll") { state =>
Project.runTask(test in (slickTestkitProject, Test), state) flatMap {
case (s, Inc(_)) => Some(s)
case (s, _) =>
Project.runTask(test in (slickTestkitProject, DocTest), state).map(_._1)
} getOrElse state
}

/* Project Definitions */
lazy val aRootProject = Project(id = "root", base = file("."),
settings = Project.defaultSettings ++ sharedSettings ++ extTarget("root", Some("target/root")) ++ Seq(
sourceDirectory := file("target/root-src"),
publishArtifact := false,
test := (), // suppress test status output
testOnly := ()
testOnly := (),
commands += testAll
)).aggregate(slickProject, slickTestkitProject)
lazy val slickProject: Project = Project(id = "slick", base = file("."),
settings = Project.defaultSettings ++ inConfig(config("macro"))(Defaults.configSettings) ++ sharedSettings ++ fmppSettings ++ site.settings ++ site.sphinxSupport() ++ mimaDefaultSettings ++ extTarget("slick", None) ++ Seq(
Expand Down
Expand Up @@ -194,7 +194,7 @@ class JdbcMapperTest extends TestkitTest[JdbcTestDB] {
// A Shape that maps Pair to a ProductNode
final class PairShape[Level <: ShapeLevel, M <: Pair[_,_], U <: Pair[_,_] : ClassTag, P <: Pair[_,_]](val shapes: Seq[Shape[_, _, _, _]]) extends MappedScalaProductShape[Level, Pair[_,_], M, U, P] {
def buildValue(elems: IndexedSeq[Any]) = Pair(elems(0), elems(1))
def copy(shapes: Seq[Shape[_, _, _, _]]) = new PairShape(shapes)
def copy(shapes: Seq[Shape[_ <: ShapeLevel, _, _, _]]) = new PairShape(shapes)
}
implicit def pairShape[Level <: ShapeLevel, M1, M2, U1, U2, P1, P2](implicit s1: Shape[_ <: Level, M1, U1, P1], s2: Shape[_ <: Level, M2, U2, P2]) =
new PairShape[Level, Pair[M1, M2], Pair[U1, U2], Pair[P1, P2]](Seq(s1, s2))
Expand Down
Expand Up @@ -71,7 +71,7 @@ class RelationalMiscTest extends TestkitTest[RelationalTestDB] {

implicit class TupledQueryExtensionMethods[E1, E2, U1, U2, C[_]](q: Query[(E1, E2), (U1, U2), C]) {
def sortedValues(implicit ordered: (E1 => Ordered),
shape: Shape[ShapeLevel.Flat, E2, U2, E2]): Query[E2, U2, C] =
shape: Shape[FlatShapeLevel, E2, U2, E2]): Query[E2, U2, C] =
q.sortBy(_._1).map(_._2)
}

Expand Down
Expand Up @@ -7,67 +7,67 @@ import scala.slick.lifted.{Shape, ShapeLevel}
class NestedShapesTest {
def legal = {
// Flat and Nested alike, only Mixed specified
implicitly[Shape[ShapeLevel.Flat, Int, _, _]]
implicitly[Shape[ShapeLevel.Flat, (Int, String), _, _]]
implicitly[Shape[ShapeLevel.Flat, (Column[Int], Int), _, _]]
implicitly[Shape[ShapeLevel.Flat, (Column[Int], (Int, Column[String])), _, _]]
implicitly[Shape[ShapeLevel.Nested, Int, _, _]]
implicitly[Shape[ShapeLevel.Nested, (Int, String), _, _]]
implicitly[Shape[ShapeLevel.Nested, (Column[Int], Int), _, _]]
implicitly[Shape[ShapeLevel.Nested, (Column[Int], (Int, Column[String])), _, _]]
implicitly[Shape[FlatShapeLevel, Int, _, _]]
implicitly[Shape[FlatShapeLevel, (Int, String), _, _]]
implicitly[Shape[FlatShapeLevel, (Column[Int], Int), _, _]]
implicitly[Shape[FlatShapeLevel, (Column[Int], (Int, Column[String])), _, _]]
implicitly[Shape[NestedShapeLevel, Int, _, _]]
implicitly[Shape[NestedShapeLevel, (Int, String), _, _]]
implicitly[Shape[NestedShapeLevel, (Column[Int], Int), _, _]]
implicitly[Shape[NestedShapeLevel, (Column[Int], (Int, Column[String])), _, _]]

// Flat and Nested alike, fully specified
implicitly[Shape[ShapeLevel.Flat, Int, Int, Column[Int]]]
implicitly[Shape[ShapeLevel.Flat, (Int, String), (Int, String), (Column[Int], Column[String])]]
implicitly[Shape[ShapeLevel.Flat, (Column[Int], Int), (Int, Int), (Column[Int], Column[Int])]]
implicitly[Shape[ShapeLevel.Flat, (Column[Int], (Int, Column[String])), (Int, (Int, String)), (Column[Int], (Column[Int], Column[String]))]]
implicitly[Shape[ShapeLevel.Nested, Int, Int, Column[Int]]]
implicitly[Shape[ShapeLevel.Nested, (Int, String), (Int, String), (Column[Int], Column[String])]]
implicitly[Shape[ShapeLevel.Nested, (Column[Int], Int), (Int, Int), (Column[Int], Column[Int])]]
implicitly[Shape[ShapeLevel.Nested, (Column[Int], (Int, Column[String])), (Int, (Int, String)), (Column[Int], (Column[Int], Column[String]))]]
implicitly[Shape[FlatShapeLevel, Int, Int, Column[Int]]]
implicitly[Shape[FlatShapeLevel, (Int, String), (Int, String), (Column[Int], Column[String])]]
implicitly[Shape[FlatShapeLevel, (Column[Int], Int), (Int, Int), (Column[Int], Column[Int])]]
implicitly[Shape[FlatShapeLevel, (Column[Int], (Int, Column[String])), (Int, (Int, String)), (Column[Int], (Column[Int], Column[String]))]]
implicitly[Shape[NestedShapeLevel, Int, Int, Column[Int]]]
implicitly[Shape[NestedShapeLevel, (Int, String), (Int, String), (Column[Int], Column[String])]]
implicitly[Shape[NestedShapeLevel, (Column[Int], Int), (Int, Int), (Column[Int], Column[Int])]]
implicitly[Shape[NestedShapeLevel, (Column[Int], (Int, Column[String])), (Int, (Int, String)), (Column[Int], (Column[Int], Column[String]))]]

// Only Nested, only Mixed specified
implicitly[Shape[ShapeLevel.Nested, Query[Column[Int], Int, Seq], _, _]] // 1
implicitly[Shape[ShapeLevel.Nested, Query[(Column[Int], Column[String]), (Int, String), Seq], _, _]] // 2
implicitly[Shape[ShapeLevel.Nested, (Column[Int], Query[(Column[Int], Column[String]), (Int, String), Seq]), _, _]] // 3
implicitly[Shape[ShapeLevel.Nested, (Int, Query[(Column[Int], Column[String]), (Int, String), Seq]), _, _]] // 4
implicitly[Shape[NestedShapeLevel, Query[Column[Int], Int, Seq], _, _]] // 1
implicitly[Shape[NestedShapeLevel, Query[(Column[Int], Column[String]), (Int, String), Seq], _, _]] // 2
implicitly[Shape[NestedShapeLevel, (Column[Int], Query[(Column[Int], Column[String]), (Int, String), Seq]), _, _]] // 3
implicitly[Shape[NestedShapeLevel, (Int, Query[(Column[Int], Column[String]), (Int, String), Seq]), _, _]] // 4

// Only Nested, fully specified
implicitly[Shape[ShapeLevel.Nested, Query[Column[Int], Int, Seq], Seq[Int], Query[Column[Int], Int, Seq]]] // 5
implicitly[Shape[ShapeLevel.Nested, Query[(Column[Int], Column[String]), (Int, String), Seq], Seq[(Int, String)], Query[(Column[Int], Column[String]), (Int, String), Seq]]] // 6
implicitly[Shape[ShapeLevel.Nested, (Column[Int], Query[(Column[Int], Column[String]), (Int, String), Seq]), (Int, Seq[(Int, String)]), (Column[Int], Query[(Column[Int], Column[String]), (Int, String), Seq])]] // 7
implicitly[Shape[ShapeLevel.Nested, (Int, Query[(Column[Int], Column[String]), (Int, String), Seq]), (Int, Seq[(Int, String)]), (Column[Int], Query[(Column[Int], Column[String]), (Int, String), Seq])]] // 8
implicitly[Shape[NestedShapeLevel, Query[Column[Int], Int, Seq], Seq[Int], Query[Column[Int], Int, Seq]]] // 5
implicitly[Shape[NestedShapeLevel, Query[(Column[Int], Column[String]), (Int, String), Seq], Seq[(Int, String)], Query[(Column[Int], Column[String]), (Int, String), Seq]]] // 6
implicitly[Shape[NestedShapeLevel, (Column[Int], Query[(Column[Int], Column[String]), (Int, String), Seq]), (Int, Seq[(Int, String)]), (Column[Int], Query[(Column[Int], Column[String]), (Int, String), Seq])]] // 7
implicitly[Shape[NestedShapeLevel, (Int, Query[(Column[Int], Column[String]), (Int, String), Seq]), (Int, Seq[(Int, String)]), (Column[Int], Query[(Column[Int], Column[String]), (Int, String), Seq])]] // 8
}

def illegal1 = ShouldNotTypecheck("""
implicitly[Shape[ShapeLevel.Flat, Query[Column[Int], Int, Seq], _, _]] // 1
implicitly[Shape[FlatShapeLevel, Query[Column[Int], Int, Seq], _, _]] // 1
""", "No matching Shape.*")

def illegal2 = ShouldNotTypecheck("""
implicitly[Shape[ShapeLevel.Flat, Query[(Column[Int], Column[String]), (Int, String), Seq], _, _]] // 2
implicitly[Shape[FlatShapeLevel, Query[(Column[Int], Column[String]), (Int, String), Seq], _, _]] // 2
""", "No matching Shape.*")

def illegal3 = ShouldNotTypecheck("""
implicitly[Shape[ShapeLevel.Flat, (Column[Int], Query[(Column[Int], Column[String]), (Int, String), Seq]), _, _]] // 3
implicitly[Shape[FlatShapeLevel, (Column[Int], Query[(Column[Int], Column[String]), (Int, String), Seq]), _, _]] // 3
""", "No matching Shape.*")

def illegal4 = ShouldNotTypecheck("""
implicitly[Shape[ShapeLevel.Flat, (Int, Query[(Column[Int], Column[String]), (Int, String), Seq]), _, _]] // 4
implicitly[Shape[FlatShapeLevel, (Int, Query[(Column[Int], Column[String]), (Int, String), Seq]), _, _]] // 4
""", "No matching Shape.*")

def illegal5 = ShouldNotTypecheck("""
implicitly[Shape[ShapeLevel.Flat, Query[Column[Int], Int, Seq], Seq[Int], Query[Column[Int], Int, Seq]]] // 5
implicitly[Shape[FlatShapeLevel, Query[Column[Int], Int, Seq], Seq[Int], Query[Column[Int], Int, Seq]]] // 5
""", "No matching Shape.*")

def illegal6 = ShouldNotTypecheck("""
implicitly[Shape[ShapeLevel.Flat, Query[(Column[Int], Column[String]), (Int, String), Seq], Seq[(Int, String)], Query[(Column[Int], Column[String]), (Int, String), Seq]]] // 6
implicitly[Shape[FlatShapeLevel, Query[(Column[Int], Column[String]), (Int, String), Seq], Seq[(Int, String)], Query[(Column[Int], Column[String]), (Int, String), Seq]]] // 6
""", "No matching Shape.*")

def illegal7 = ShouldNotTypecheck("""
implicitly[Shape[ShapeLevel.Flat, (Column[Int], Query[(Column[Int], Column[String]), (Int, String), Seq]), (Int, Seq[(Int, String)]), (Column[Int], Query[(Column[Int], Column[String]), (Int, String), Seq])]] // 7
implicitly[Shape[FlatShapeLevel, (Column[Int], Query[(Column[Int], Column[String]), (Int, String), Seq]), (Int, Seq[(Int, String)]), (Column[Int], Query[(Column[Int], Column[String]), (Int, String), Seq])]] // 7
""", "No matching Shape.*")

def illegal8 = ShouldNotTypecheck("""
implicitly[Shape[ShapeLevel.Flat, (Int, Query[(Column[Int], Column[String]), (Int, String), Seq]), (Int, Seq[(Int, String)]), (Column[Int], Query[(Column[Int], Column[String]), (Int, String), Seq])]] // 8
implicitly[Shape[FlatShapeLevel, (Int, Query[(Column[Int], Column[String]), (Int, String), Seq]), (Int, Seq[(Int, String)]), (Column[Int], Query[(Column[Int], Column[String]), (Int, String), Seq])]] // 8
""", "No matching Shape.*")
}
Expand Up @@ -61,7 +61,7 @@ object MacroSupportInterpolationImpl {
val s = pit.next()
val ae @ Expr(a) = ait.next()
val len = s.length
val marker = if(len == 0) '\0' else s.charAt(len-1)
val marker = if(len == 0) '\u0000' else s.charAt(len-1)
marker match {
case '`' =>
exprs ++= appendString(s.substring(0, len-1))
Expand Down
Expand Up @@ -129,7 +129,7 @@ final object HList {

final class HListShape[Level <: ShapeLevel, M <: HList, U <: HList : ClassTag, P <: HList](val shapes: Seq[Shape[_, _, _, _]]) extends MappedScalaProductShape[Level, HList, M, U, P] {
def buildValue(elems: IndexedSeq[Any]) = elems.foldRight(HNil: HList)(_ :: _)
def copy(shapes: Seq[Shape[_, _, _, _]]) = new HListShape(shapes)
def copy(shapes: Seq[Shape[_ <: ShapeLevel, _, _, _]]) = new HListShape(shapes)
}
implicit def hnilShape[Level <: ShapeLevel] = new HListShape[Level, HNil.type, HNil.type, HNil.type](Nil)
implicit def hconsShape[Level <: ShapeLevel, L1 <: Level, L2 <: Level, M1, M2 <: HList, U1, U2 <: HList, P1, P2 <: HList](implicit s1: Shape[L1, M1, U1, P1], s2: HListShape[L2, M2, U2, P2]) =
Expand Down
19 changes: 12 additions & 7 deletions src/main/scala/scala/slick/direct/SlickBackend.scala
Expand Up @@ -11,6 +11,11 @@ import scala.reflect.ClassTag
import scala.reflect.runtime.universe.TypeRef
import scala.annotation.StaticAnnotation
import scala.reflect.runtime.universe._

// TODO 2.11 Remove this after dropping 2.10.x support
// http://docs.scala-lang.org/overviews/macros/changelog211.html
private object HasCompat { val compat = ??? }; import HasCompat._

import scala.reflect.runtime.{currentMirror=>cm}

/** maps a Scala method to a Slick FunctionSymbol */
Expand Down Expand Up @@ -77,14 +82,15 @@ object CustomNodes{
import CustomNodes._

class SlickBackend( val driver: JdbcDriver, mapper:Mapper ) extends QueryableBackend{
import scala.reflect.runtime.universe.{Scope => _, _}
import compat._
type Session = JdbcDriver#Backend#Session
import slick.ast.ScalaBaseType
val columnTypes = {
Map( // FIXME use symbols instead of strings for type names here
typeOf[Int].typeSymbol -> ScalaBaseType.intType
,typeOf[Double].typeSymbol -> ScalaBaseType.doubleType
,typeOf[String].typeSymbol -> ScalaBaseType.stringType
,typeOf[Boolean].typeSymbol -> ScalaBaseType.booleanType
typeOf[Int].typeSymbol -> sq.ScalaBaseType.intType
,typeOf[Double].typeSymbol -> sq.ScalaBaseType.doubleType
,typeOf[String].typeSymbol -> sq.ScalaBaseType.stringType
,typeOf[Boolean].typeSymbol -> sq.ScalaBaseType.booleanType
)
}
/** generates a map from Scala symbols to Slick FunctionSymbols from description in OperatorMapping */
Expand Down Expand Up @@ -366,8 +372,7 @@ class SlickBackend( val driver: JdbcDriver, mapper:Mapper ) extends QueryableBac
op,
components
)
if definitions
.TupleClass
if (2 to 22).map(definitions.TupleClass)
.filter(_ != NoSymbol)
.map( _.companionSymbol.typeSignature.member( newTermName("apply") ) )
.contains( op.symbol )
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/scala/slick/driver/JdbcExecutorComponent.scala
Expand Up @@ -6,7 +6,7 @@ import scala.slick.ast.Util._
import scala.slick.ast.TypeUtil._
import scala.slick.util.SQLBuilder
import scala.slick.profile.SqlExecutorComponent
import scala.slick.lifted.{Shape, ShapeLevel}
import scala.slick.lifted.{Shape, FlatShapeLevel}

trait JdbcExecutorComponent extends SqlExecutorComponent { driver: JdbcDriver =>

Expand All @@ -33,7 +33,7 @@ trait JdbcExecutorComponent extends SqlExecutorComponent { driver: JdbcDriver =>
}

class UnshapedQueryExecutorDef[M](value: M) extends super.UnshapedQueryExecutorDef[M](value) {
@inline final def selectStatement[U](implicit shape: Shape[_ <: ShapeLevel.Flat, M, U, _], session: Backend#Session): String =
@inline final def selectStatement[U](implicit shape: Shape[_ <: FlatShapeLevel, M, U, _], session: Backend#Session): String =
executor[U].selectStatement
}
}
6 changes: 3 additions & 3 deletions src/main/scala/scala/slick/driver/JdbcInvokerComponent.scala
Expand Up @@ -4,7 +4,7 @@ import scala.language.higherKinds
import java.sql.{Statement, PreparedStatement}
import scala.slick.SlickException
import scala.slick.ast.{Insert, CompiledStatement, ResultSetMapping, Node}
import scala.slick.lifted.{ShapeLevel, Query, Shape}
import scala.slick.lifted.{FlatShapeLevel, Query, Shape}
import scala.slick.jdbc._
import scala.slick.util.SQLBuilder
import scala.slick.profile.BasicInvokerComponent
Expand Down Expand Up @@ -87,7 +87,7 @@ trait JdbcInvokerComponent extends BasicInvokerComponent{ driver: JdbcDriver =>
lazy val insertStatement = insertResult.sql
lazy val forceInsertStatement = insertForcedResult.sql
def insertStatementFor[TT, C[_]](query: Query[TT, U, C]): String = builder.buildInsert(query).sql
def insertStatementFor[TT](c: TT)(implicit shape: Shape[_ <: ShapeLevel.Flat, TT, U, _]): String = insertStatementFor(Query(c)(shape))
def insertStatementFor[TT](c: TT)(implicit shape: Shape[_ <: FlatShapeLevel, TT, U, _]): String = insertStatementFor(Query(c)(shape))

def useBatchUpdates(implicit session: Backend#Session) = session.capabilities.supportsBatchUpdates

Expand Down Expand Up @@ -152,7 +152,7 @@ trait JdbcInvokerComponent extends BasicInvokerComponent{ driver: JdbcDriver =>

protected def retQuery(st: Statement, updateCount: Int): QueryInsertResult

def insertExpr[TT](c: TT)(implicit shape: Shape[_ <: ShapeLevel.Flat, TT, U, _], session: Backend#Session): QueryInsertResult =
def insertExpr[TT](c: TT)(implicit shape: Shape[_ <: FlatShapeLevel, TT, U, _], session: Backend#Session): QueryInsertResult =
insert(Query(c)(shape))(session)

def insert[TT, C[_]](query: Query[TT, U, C])(implicit session: Backend#Session): QueryInsertResult = {
Expand Down
6 changes: 3 additions & 3 deletions src/main/scala/scala/slick/lifted/AbstractTable.scala
Expand Up @@ -66,7 +66,7 @@ abstract class AbstractTable[T](val tableTag: Tag, val schemaName: Option[String
def foreignKey[P, PU, TT <: AbstractTable[_], U]
(name: String, sourceColumns: P, targetTableQuery: TableQuery[TT])
(targetColumns: TT => P, onUpdate: model.ForeignKeyAction = model.ForeignKeyAction.NoAction,
onDelete: model.ForeignKeyAction = model.ForeignKeyAction.NoAction)(implicit unpack: Shape[_ <: ShapeLevel.Flat, TT, U, _], unpackp: Shape[_ <: ShapeLevel.Flat, P, PU, _]): ForeignKeyQuery[TT, U] = {
onDelete: model.ForeignKeyAction = model.ForeignKeyAction.NoAction)(implicit unpack: Shape[_ <: FlatShapeLevel, TT, U, _], unpackp: Shape[_ <: FlatShapeLevel, P, PU, _]): ForeignKeyQuery[TT, U] = {
val targetTable: TT = targetTableQuery.shaped.value
val q = targetTableQuery.asInstanceOf[Query[TT, U, Seq]]
val generator = new AnonSymbol
Expand All @@ -82,7 +82,7 @@ abstract class AbstractTable[T](val tableTag: Tag, val schemaName: Option[String
* key column but this method allows you to define compound primary keys
* or give them user-defined names (when defining the database schema
* with Slick). */
def primaryKey[T](name: String, sourceColumns: T)(implicit shape: Shape[_ <: ShapeLevel.Flat, T, _, _]): PrimaryKey = PrimaryKey(name, ExtraUtil.linearizeFieldRefs(shape.toNode(sourceColumns)))
def primaryKey[T](name: String, sourceColumns: T)(implicit shape: Shape[_ <: FlatShapeLevel, T, _, _]): PrimaryKey = PrimaryKey(name, ExtraUtil.linearizeFieldRefs(shape.toNode(sourceColumns)))

def tableConstraints: Iterator[Constraint] = for {
m <- getClass().getMethods.iterator
Expand All @@ -97,7 +97,7 @@ abstract class AbstractTable[T](val tableTag: Tag, val schemaName: Option[String
tableConstraints.collect{ case k: PrimaryKey => k }.toIndexedSeq

/** Define an index or a unique constraint. */
def index[T](name: String, on: T, unique: Boolean = false)(implicit shape: Shape[_ <: ShapeLevel.Flat, T, _, _]) = new Index(name, this, ExtraUtil.linearizeFieldRefs(shape.toNode(on)), unique)
def index[T](name: String, on: T, unique: Boolean = false)(implicit shape: Shape[_ <: FlatShapeLevel, T, _, _]) = new Index(name, this, ExtraUtil.linearizeFieldRefs(shape.toNode(on)), unique)

def indexes: Iterable[Index] = (for {
m <- getClass().getMethods.view
Expand Down
4 changes: 3 additions & 1 deletion src/main/scala/scala/slick/lifted/Aliases.scala
Expand Up @@ -37,7 +37,9 @@ trait Aliases {
type MappedProductShape[Level <: ShapeLevel, C, M <: C, U <: C, P <: C] = lifted.MappedProductShape[Level, C, M, U, P]
type MappedScalaProductShape[Level <: ShapeLevel, C <: Product, M <: C, U <: C, P <: C] = lifted.MappedScalaProductShape[Level, C, M, U, P]
type ShapeLevel = lifted.ShapeLevel
val ShapeLevel = lifted.ShapeLevel
type NestedShapeLevel = lifted.NestedShapeLevel
type FlatShapeLevel = lifted.FlatShapeLevel
type ColumnsShapeLevel = lifted.ColumnsShapeLevel
type Isomorphism[A, B] = lifted.Isomorphism[A, B]
type MappedTo[T] = lifted.MappedTo[T]
}

0 comments on commit 2dca474

Please sign in to comment.