Search code examples
scalaslick

Does slick care if I have a foreign key setup in my database?


When making joins using slick, does slick care if I have a foreign key constraint setup at the database schema level?


Solution

  • Slick will work regardless of if your Slick schema has a foreign key defined or not.

    This is from the Constraints section of the docs:

    Independent of the actual constraint defined in the database, such a foreign key can be used to navigate to the referenced data with a join. For this purpose, it behaves the same as a manually defined utility method for finding the joined data.