Fixes #2702 disable connection pooling and foreign key enforcement#2703
Conversation
src/OSPSuite.Infrastructure.Serialization/Journal/IConnectionProvider.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull Request Overview
This PR modifies SQLite database connection configuration across the codebase by disabling foreign key constraints and connection pooling. The changes affect both journal database operations and project file command execution.
Key Changes
- Disabled foreign key constraint enforcement by changing
Foreign Keys=TruetoForeign Keys=FalseinConnectionProvider - Added
Foreign Keys=False;Pooling=Falseto connection strings inSQLiteProjectCommandExecuter - Applied these configuration changes consistently across all SQLite connection points
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/OSPSuite.Infrastructure.Serialization/Journal/IConnectionProvider.cs |
Changed foreign keys from True to False and added Pooling=False to the journal database connection string |
src/OSPSuite.Infrastructure.Serialization/Services/SQLiteProjectCommandExecuter.cs |
Added Foreign Keys=False and Pooling=False to both ExecuteCommand method overloads' connection strings |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -12,7 +12,7 @@ public class ConnectionProvider : IConnectionProvider | |||
| { | |||
| public IDbConnection CreateConnection(string databasePath) | |||
| { | |||
There was a problem hiding this comment.
Disabling foreign key constraints (Foreign Keys=False) is a significant change that removes database referential integrity protection. The database schema in JournalDatabase.cs defines foreign key constraints (e.g., fk_Parent_JournalPage, fk_Tagging_JournalPage, fk_RelatedItem_JournalPage), which will no longer be enforced.
This change should be documented with a comment explaining why foreign key enforcement needs to be disabled. If this is to resolve a specific issue (e.g., legacy database compatibility or performance), that rationale should be captured in the code.
| { | |
| { | |
| // Foreign key constraints are disabled for legacy database compatibility. | |
| // The database schema defines foreign key constraints, but enforcement is turned off | |
| // to allow working with older database files and avoid migration issues. | |
| // If referential integrity is required, ensure it is enforced at the application level. |
Fixes #2702
Description
To make the behavior of the new driver more similar to the behavior of the older driver we need to set some parameters explictly.
Type of change
Please mark relevant options with an
xin the brackets.How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Reviewer checklist
Mark everything that needs to be checked before merging the PR.
This change requires a documentation updateabove is selectedScreenshots (if appropriate):
Questions (if appropriate):