The following should work against the main ScalaQuery branch:
object myTable2 extends Table([Int, Int, Int])("myTable2") { def pk1 = column[Int]("id1") def pk2 = column[Int]("id2") def fk1 = column[Int]("fk1") def * = pk1 ~ pk2 ~ fk1 def pk = primaryKey("pk_myTable2", pk1 ~ pk2) def fkMyTable1 = foreignKey("myTable1_fk", fk1, myTable1)(_.id) }
Although fk1 in myTable2 is the base column, fkMyTable1 is a foreign key definition that doubles as a foreign key join. Foreign keys are available in ScalaQuery 0.9.1, explicit primary keys (with names and multi-column support) are currently available in master and will be included in 0.9.2. You can find more examples in the unit test classes ForeignKeyTest and PrimaryKeyTest.
szeiger
source share