Set sqlite PRAGMA via Url

This commit is contained in:
AsamK 2025-01-14 22:31:36 +01:00
parent e4af0be0ad
commit 74c2604dc8

View file

@ -95,10 +95,9 @@ public abstract class Database implements AutoCloseable {
sqliteConfig.setTransactionMode(SQLiteConfig.TransactionMode.IMMEDIATE);
HikariConfig config = new HikariConfig();
config.setJdbcUrl("jdbc:sqlite:" + databaseFile);
config.setJdbcUrl("jdbc:sqlite:" + databaseFile + "?foreign_keys=ON");
config.setDataSourceProperties(sqliteConfig.toProperties());
config.setMinimumIdle(1);
config.setConnectionInitSql("PRAGMA foreign_keys=ON");
return new HikariDataSource(config);
}
}