Improve build reliability, query perf, and documentation

- Add build-error-resolution.md guide for CS0006 and IDE analyzer issues
- Add rebuild-solution.ps1 script for clean/reliable builds
- Suppress noisy IDE/StyleCop warnings in .editorconfig
- Optimize BaseItemRepository grouping queries to use Min(Id) instead of FirstOrDefault, avoiding correlated subqueries and greatly improving DB performance
- Add database-query-optimization.md explaining query changes and tuning
- Enable EF Core SQL query logging, sensitive data, and detailed errors when log level is Debug (ServiceCollectionExtensions, logging.json)
- Update readme with SQL logging instructions
- Clarify git commit/ignore guidance and improve inline documentation
This commit is contained in:
2026-03-01 09:49:30 -05:00
parent dec2e5ac08
commit 23ed81b6b1
8 changed files with 460 additions and 5 deletions
+39
View File
@@ -23,3 +23,42 @@ dotnet ef migrations add {MIGRATION_NAME} --project "src/Jellyfin.Database/Jelly
If you get the error: `Run "dotnet tool restore" to make the "dotnet-ef" command available.` Run `dotnet restore`.
in the event that you get the error: `System.UnauthorizedAccessException: Access to the path '/src/Jellyfin.Database' is denied.` you have to restore as sudo and then run `ef migrations` as sudo too.
# Database Query Logging
To enable SQL query logging for debugging purposes, you need to configure the logging level in your `logging.json` file located at `Resources/Configuration/logging.json`.
## Enable SQL Query Logging
To see all executed SQL queries in the logs, change the logging level for Entity Framework Core database commands:
```json
{
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"System": "Warning",
"Microsoft.EntityFrameworkCore.Database.Command": "Debug"
}
}
}
}
```
When `Microsoft.EntityFrameworkCore.Database.Command` is set to `Debug`, the following will be logged:
- All SQL queries being executed
- Query parameters (including sensitive data)
- Query execution times
- Detailed error messages
## Logging Levels
- **Debug**: Logs all SQL queries with parameters and execution details
- **Information**: Logs queries without parameters (default setting in the configuration)
- **Warning**: Only logs slow queries and warnings
- **Error**: Only logs database errors
**Note**: Query logging with sensitive data is automatically enabled when using Debug level. Be careful not to expose sensitive information in production environments.