Files
pgsql-jellyfin/docs/CS0006_SQLITE_FIX.md
wjones 5197948fcc Remove SQLite runtime provider; keep for migration only
SQLite provider removed from service collection and runtime database options. Microsoft.Data.Sqlite package added to Jellyfin.Server for migration routines (SQLite → PostgreSQL). Migration service updated to always use PostgreSQL. SqliteExtensions restored for migration helpers. SQLite migration test deleted. Documentation added to explain migration-only support and deployment impact. No breaking changes for users migrating from SQLite; deployment size increases (~68 MB) for cross-platform SQLite DLLs.
2026-02-26 17:14:30 -05:00

230 lines
5.2 KiB
Markdown

# CS0006 Error Fix - SQLite References Removal
**Error:** CS0006 - Metadata file could not be found
**Root Cause:** Code still references SQLite types after removing SQLite dependencies
**Status:** ✅ Partially Fixed - Migration code needs special handling
---
## Errors Found and Fixed
### ✅ Fixed Issues
1. **Jellyfin.Server.Implementations\Extensions\ServiceCollectionExtensions.cs**
- ❌ Line 16: `using Jellyfin.Database.Providers.Sqlite;`**REMOVED**
- ❌ Line 31: `yield return typeof(SqliteDatabaseProvider);`**REMOVED**
2. **Emby.Server.Implementations\Data\SqliteExtensions.cs**
- ❌ Entire file → **DELETED** (not used anywhere)
---
## ⚠️ Remaining Issues - Migration Routines
These files in `Jellyfin.Server\Migrations\Routines\` still reference SQLite:
1. `MigrateActivityLogDb.cs`
2. `MigrateAuthenticationDb.cs`
3. `MigrateDisplayPreferencesDb.cs`
4. `MigrateLibraryDb.cs`
5. `MigrateLibraryDbCompatibilityCheck.cs`
6. `MigrateLibraryUserData.cs`
7. `MigrateUserDb.cs`
8. `RemoveDuplicateExtras.cs`
9. `ReseedFolderFlag.cs`
**Why they exist:** These are migration routines to migrate FROM SQLite TO PostgreSQL
---
## Decision: What to Do About Migrations?
### Option 1: Keep SQLite Package for Migrations Only ✅ RECOMMENDED
**Pros:**
- Users can still migrate from SQLite
- No breaking changes
- SQLite DLLs only used during migration
**Implementation:**
1. Add `Microsoft.Data.Sqlite` back to `Jellyfin.Server.csproj` ONLY
2. Migrations can run when needed
3. SQLite provider project still removed (no SQLite for runtime database)
**Result:** SQLite DLLs in deployment, but ONLY for migration support
---
### Option 2: Remove Migration Code Entirely ❌ NOT RECOMMENDED
**Pros:**
- No SQLite dependencies at all
- Smaller deployment
**Cons:**
- Users CANNOT migrate from SQLite
- Breaking change for existing users
- Requires manual migration
---
### Option 3: Make Migrations Optional Plugin
**Pros:**
- Clean deployment (no SQLite)
- Migration still possible via plugin
**Cons:**
- Complex to implement
- Extra step for users
---
## ✅ RECOMMENDED SOLUTION
**Add SQLite package ONLY to Jellyfin.Server for migration support**
This allows:
- Migration FROM SQLite TO PostgreSQL
- No SQLite as runtime database
- Minimal impact on deployment size (~5MB)
---
## Implementation Steps
### Step 1: Add Microsoft.Data.Sqlite to Jellyfin.Server
```xml
<!-- In Jellyfin.Server/Jellyfin.Server.csproj -->
<ItemGroup>
<!-- SQLite package for migration routines only -->
<PackageReference Include="Microsoft.Data.Sqlite" />
</ItemGroup>
```
### Step 2: Rebuild
```powershell
dotnet clean
dotnet build --configuration Release
```
### Step 3: Verify
- ✅ Build succeeds
- ✅ SQLite DLLs present for migrations
- ✅ SQLite NOT used as runtime database
- ✅ Only PostgreSQL provider in service collection
---
## Alternative: Remove Migrations
If you want ZERO SQLite dependencies:
### Step 1: Delete Migration Files
```powershell
Remove-Item "Jellyfin.Server\Migrations\Routines\*" -Recurse
```
### Step 2: Document Migration Process
Create `docs/SQLITE_TO_POSTGRES_MANUAL_MIGRATION.md` with manual steps
### Step 3: Update README
```markdown
**Note:** This build does NOT support migrating from SQLite.
Use the official Jellyfin tools to migrate first, then switch to this version.
```
---
## Size Impact
### With Migration Support (Recommended)
```
SQLite DLLs:
- Microsoft.Data.Sqlite.dll: ~400 KB
- SQLitePCLRaw.*.dll: ~2-5 MB
Total: ~5-7 MB added
```
### Without Migration Support
```
Total: 0 MB
But users cannot migrate from SQLite
```
---
## Current Status
**Fixed:**
- ServiceCollectionExtensions.cs (provider registration)
- SqliteExtensions.cs (deleted)
- Package reference removed from Emby.Server.Implementations
**Still has SQLite references:**
- 9 migration routine files in Jellyfin.Server
---
## Next Steps (Choose One)
### Approach A: Keep Migrations (Recommended) ✅
```powershell
# Add package to Jellyfin.Server.csproj
# Then rebuild
dotnet build --configuration Release
```
### Approach B: Remove Migrations
```powershell
# Delete migration routines
Remove-Item "E:\Projects\pgsql-jellyfin\Jellyfin.Server\Migrations\Routines\Migrate*.cs"
Remove-Item "E:\Projects\pgsql-jellyfin\Jellyfin.Server\Migrations\Routines\Reseed*.cs"
Remove-Item "E:\Projects\pgsql-jellyfin\Jellyfin.Server\Migrations\Routines\Remove*.cs"
# Rebuild
dotnet build --configuration Release
```
---
## Recommendation
**✅ Use Approach A: Keep SQLite for migrations**
**Why:**
1. Users can still migrate their data
2. Minimal size impact (~5MB)
3. One-time cost (migrations run once)
4. No breaking changes for users transitioning from SQLite
**When to use Approach B:**
- You're distributing to NEW users only
- No one needs SQLite migration
- You want absolutely zero SQLite code
---
## Summary
**Problem:** CS0006 error due to SQLite references
**Root Cause:** Migration code needs SQLite
**Solution:** Add `Microsoft.Data.Sqlite` to `Jellyfin.Server.csproj` for migration support
**Result:** Build succeeds, migrations work, no SQLite as runtime database
---
**What do you prefer?**
1. Keep migrations (add SQLite package back for migrations)
2. Remove migrations (delete migration files, zero SQLite)
Let me know and I'll implement it!