Add PostgresSubprocessException and refactor database initialization logic

- Introduced PostgresSubprocessException to handle errors during PostgreSQL subprocess execution.
- Refactored PostgresDatabaseProvider to improve schema initialization script discovery.
- Enhanced error handling for psql command execution, including logging of output and errors.
- Implemented methods to find the schema initialization script and the psql executable path.
This commit is contained in:
2026-07-08 11:53:36 -04:00
parent 4f651fc239
commit 1abf61a05f
52 changed files with 723 additions and 9854268 deletions
+1 -1
View File
@@ -308,7 +308,7 @@ STACK TRACE:
AFFECTED FILES:
SQL Schema:
└─ Jellyfin.Server/sql/schema_init/create_database_schema.sql
└─ scripts/sql/schema_init/create_database_schema.sql
Lines: 92-886 (31 tables with PascalCase names)
C# Configuration:
+1 -1
View File
@@ -453,7 +453,7 @@ public void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
- `src/Jellyfin.Database/Jellyfin.Database.Implementations/ModelConfiguration/`
### Database Schema Files
1. `Jellyfin.Server/sql/schema_init/create_database_schema.sql`
1. `scripts/sql/schema_init/create_database_schema.sql`
- Lines 92-886 (all table definitions)
---
+1 -1
View File
@@ -81,7 +81,7 @@ Creates 23 performance indexes automatically
1. **`publish-with-sql.ps1`** - Automated publish + copy script ⭐
2. **`copy-sql-files.ps1`** - Manual copy script
3. **`Jellyfin.Server/sql/`** - SQL files directory
3. **`scripts/sql/`** - SQL files directory
---
+1 -1
View File
@@ -156,7 +156,7 @@ Update system table for consistency:
---
## File Location
- **Source**: `Jellyfin.Server/sql/schema_init/create_database_schema.sql` (1879 lines)
- **Source**: `scripts/sql/schema_init/create_database_schema.sql` (1879 lines)
- **Output**: Same file (in-place conversion)
---
+2 -2
View File
@@ -42,7 +42,7 @@ dotnet publish Jellyfin.Server\Jellyfin.Server.csproj -c Release
### Solution 3: Fixed Project Structure
**Changed:**
- Copied SQL files from `sql/` to `Jellyfin.Server/sql/`
- Copied SQL files from `sql/` to `scripts/sql/`
- Updated `Jellyfin.Server.csproj` to include them
- Files are now part of the project directly
@@ -198,7 +198,7 @@ psql -U jellyfin -d jellyfin -c "SELECT COUNT(*) FROM pg_indexes WHERE indexname
**Problem**: SQL files not included in publish
**Cause**: Files were outside project directory
**Fix**: Moved SQL files to `Jellyfin.Server/sql/` and created automated scripts
**Fix**: Moved SQL files to `scripts/sql/` and created automated scripts
**Result**: SQL files now automatically included in publish
### What You Get: