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

Foreign key for MultiDBCake example

Open suriyanto opened this issue 11 years ago • 1 comments

I followed the MultiDBCake example to be able to get different databases used between testing and production. In the table definition, I would like to set foreign key between Users and Pictures, which should be similar to below.

def pictureKey = foreignKey("FK_USER_PICTURE", pictureId, PictureComponent.Pictures)(_.id.get)

However due to the fact that the Pictures object is inside PictureComponent trait, there is no way for me to reference PictureComponent.Pictures. What will be your suggestion on adjusting this example to be able to achieve this?

Thanks, Suriyanto

suriyanto avatar Oct 23 '13 17:10 suriyanto

Hello suriyanto,

with the actual code it should work. The import line is trait UserComponent { this: Profile with PictureComponent . With the code with PictureComponent you are able to access slick definition of Pictures.

pussinboots avatar Jun 22 '14 16:06 pussinboots