1

I'm using Dropwizard and its JDBI module in order to connect to an SQLite database. I've setup the database so that it has FKs in place, but I still need to tell SQLite to enable its constraints.

I know you can configure it using a properties instance, but I don't see how to make use of that together with the JDBI setup in Dropwizard.

Sid
  • 1,709
  • 1
  • 10
  • 17

1 Answers1

1

You need to add the following property to your .yml settings file: foreign_keys: true.

It should look something like this:

database:
  # the name of your JDBC driver
  driverClass: org.sqlite.JDBC

  # the JDBC URL
  url: jdbc:sqlite:databasefile.db

  # any properties specific to your JDBC driver:
  properties:
    foreign_keys: true

After that you should have FK constraint in your SQLite database. You can check out the SQLiteConfig class for more properties.

Sid
  • 1,709
  • 1
  • 10
  • 17