Remove legacy per-feed database system #65

Closed
opened 2026-01-18 22:31:22 +00:00 by joezombie · 1 comment
joezombie commented 2026-01-18 22:31:22 +00:00 (Migrated from github.com)

Parent Epic

Part of #58 - Migrate to Entity Framework Core

Description

Remove the legacy per-feed database system after EF Core migration is complete. This is the final cleanup step.

Files to Delete

Services

  • Services/PodcastDatabaseService.cs - Legacy per-feed database service
  • Services/CentralDatabaseService.cs - Legacy central database service (raw SQL)
  • Services/ICentralDatabaseService.cs - Legacy interface

Configuration (Partial)

Remove from Models/PodcastFeedConfig.cs:

// Remove this property
public string? DatabasePath { get; set; }

Code to Remove from Program.cs

// REMOVE: Per-feed database initialization loop (lines 77-149)
foreach (var (feedName, feedConfig) in config.Value.Feeds)
{
    // ... all database initialization code
    await database.InitializeDatabaseAsync(feedName);
}

// REMOVE: Episode sync from per-feed databases (lines 199-215)
foreach (var feed in feedsToSync)
{
    var perFeedDbPath = Path.Combine(feed.Directory, "podcast.db");
    await centralDatabase.SyncEpisodesFromPerFeedDatabaseAsync(feed.Id, perFeedDbPath);
}

DI Registration Changes

// REMOVE these registrations from Program.cs
builder.Services.AddSingleton<IPodcastDatabaseService, PodcastDatabaseService>();
builder.Services.AddSingleton<ICentralDatabaseService, CentralDatabaseService>();

// KEEP (added in earlier issues)
builder.Services.AddCastrDatabase(builder.Configuration);
builder.Services.AddScoped<IFeedRepository, FeedRepository>();
builder.Services.AddScoped<IEpisodeRepository, EpisodeRepository>();
// ... etc

Configuration Cleanup

appsettings.json

{
  "PodcastFeeds": {
    // REMOVE: "CentralDatabasePath": "/data/castr.db"
    // REMOVE: DatabasePath from feed configs
    "Feeds": {
      "btb": {
        // REMOVE: "DatabasePath": "..."
      }
    }
  },
  // NEW location for database config
  "Database": {
    "Provider": "SQLite",
    "ConnectionString": "Data Source=/data/castr.db"
  }
}

CONFIGURATION.md

  • Remove documentation for per-feed DatabasePath
  • Remove CentralDatabasePath documentation
  • Add new Database section documentation

Migration Safety Checks

Before removing legacy code, ensure:

  1. Data Migration Complete

    • All feeds migrated to new database
    • All episodes present in new database
    • Download history preserved
  2. Feature Parity

    • RSS feeds generate correctly
    • Dashboard shows all data
    • Downloads work correctly
    • Episode redownload works
  3. Backup Recommendation

    • Document backup procedure for legacy databases
    • Provide migration verification script

Tasks

  • Verify all data migrated successfully
  • Delete PodcastDatabaseService.cs
  • Delete CentralDatabaseService.cs
  • Delete ICentralDatabaseService.cs
  • Remove DatabasePath from PodcastFeedConfig
  • Update Program.cs - remove legacy initialization
  • Update DI registrations
  • Update appsettings.json schema
  • Update CONFIGURATION.md
  • Update DASHBOARD.md
  • Update CLAUDE.md
  • Clean up any remaining references

Acceptance Criteria

  • No legacy database code remains
  • Application starts and runs correctly
  • All features work as before
  • Documentation updated
  • No compiler warnings about removed code
## Parent Epic Part of #58 - Migrate to Entity Framework Core ## Description Remove the legacy per-feed database system after EF Core migration is complete. This is the final cleanup step. ## Files to Delete ### Services - `Services/PodcastDatabaseService.cs` - Legacy per-feed database service - `Services/CentralDatabaseService.cs` - Legacy central database service (raw SQL) - `Services/ICentralDatabaseService.cs` - Legacy interface ### Configuration (Partial) Remove from `Models/PodcastFeedConfig.cs`: ```csharp // Remove this property public string? DatabasePath { get; set; } ``` ## Code to Remove from Program.cs ```csharp // REMOVE: Per-feed database initialization loop (lines 77-149) foreach (var (feedName, feedConfig) in config.Value.Feeds) { // ... all database initialization code await database.InitializeDatabaseAsync(feedName); } // REMOVE: Episode sync from per-feed databases (lines 199-215) foreach (var feed in feedsToSync) { var perFeedDbPath = Path.Combine(feed.Directory, "podcast.db"); await centralDatabase.SyncEpisodesFromPerFeedDatabaseAsync(feed.Id, perFeedDbPath); } ``` ## DI Registration Changes ```csharp // REMOVE these registrations from Program.cs builder.Services.AddSingleton<IPodcastDatabaseService, PodcastDatabaseService>(); builder.Services.AddSingleton<ICentralDatabaseService, CentralDatabaseService>(); // KEEP (added in earlier issues) builder.Services.AddCastrDatabase(builder.Configuration); builder.Services.AddScoped<IFeedRepository, FeedRepository>(); builder.Services.AddScoped<IEpisodeRepository, EpisodeRepository>(); // ... etc ``` ## Configuration Cleanup ### appsettings.json ```json { "PodcastFeeds": { // REMOVE: "CentralDatabasePath": "/data/castr.db" // REMOVE: DatabasePath from feed configs "Feeds": { "btb": { // REMOVE: "DatabasePath": "..." } } }, // NEW location for database config "Database": { "Provider": "SQLite", "ConnectionString": "Data Source=/data/castr.db" } } ``` ### CONFIGURATION.md - Remove documentation for per-feed DatabasePath - Remove CentralDatabasePath documentation - Add new Database section documentation ## Migration Safety Checks Before removing legacy code, ensure: 1. **Data Migration Complete** - All feeds migrated to new database - All episodes present in new database - Download history preserved 2. **Feature Parity** - RSS feeds generate correctly - Dashboard shows all data - Downloads work correctly - Episode redownload works 3. **Backup Recommendation** - Document backup procedure for legacy databases - Provide migration verification script ## Tasks - [ ] Verify all data migrated successfully - [ ] Delete PodcastDatabaseService.cs - [ ] Delete CentralDatabaseService.cs - [ ] Delete ICentralDatabaseService.cs - [ ] Remove DatabasePath from PodcastFeedConfig - [ ] Update Program.cs - remove legacy initialization - [ ] Update DI registrations - [ ] Update appsettings.json schema - [ ] Update CONFIGURATION.md - [ ] Update DASHBOARD.md - [ ] Update CLAUDE.md - [ ] Clean up any remaining references ## Acceptance Criteria - [ ] No legacy database code remains - [ ] Application starts and runs correctly - [ ] All features work as before - [ ] Documentation updated - [ ] No compiler warnings about removed code
joezombie commented 2026-01-27 08:37:23 +00:00 (Migrated from github.com)

Completed: Removed the legacy per-feed database system.

Changes Made:

  1. Created IPodcastDataService facade - High-level data service with SyncDirectoryAsync and SyncPlaylistInfoAsync (fuzzy matching)
  2. Updated all consumers to use EF Core:
    • PodcastFeedService
    • PlaylistWatcherService
    • All Blazor components (Dashboard, FeedList, FeedDetails, FeedEdit, EpisodeList, Downloads, Settings)
  3. Removed legacy services:
    • PodcastDatabaseService.cs (770 lines)
    • CentralDatabaseService.cs (1791 lines)
    • ICentralDatabaseService.cs
  4. Removed legacy configuration:
    • DatabasePath from PodcastFeedConfig
    • CentralDatabasePath from PodcastFeedsConfig
  5. Deleted legacy tests
  6. Updated documentation (CLAUDE.md, DASHBOARD.md, README.md)

Test Results:

  • All 152 tests pass
  • Code coverage: 77.48% line, 66.41% branch, 84.22% method

Commits:

  • feat: add GetByVideoIdAsync to EpisodeRepository
  • feat: add PodcastDataService facade for EF Core repositories
  • refactor: update PodcastFeedService to use EF Core
  • refactor: update PlaylistWatcherService to use EF Core
  • refactor: update Blazor components to use EF Core
  • chore: delete legacy database services
  • chore: delete legacy database service tests and config
  • docs: update documentation for EF Core migration
Completed: Removed the legacy per-feed database system. ## Changes Made: 1. **Created IPodcastDataService facade** - High-level data service with SyncDirectoryAsync and SyncPlaylistInfoAsync (fuzzy matching) 2. **Updated all consumers to use EF Core:** - PodcastFeedService - PlaylistWatcherService - All Blazor components (Dashboard, FeedList, FeedDetails, FeedEdit, EpisodeList, Downloads, Settings) 3. **Removed legacy services:** - PodcastDatabaseService.cs (770 lines) - CentralDatabaseService.cs (1791 lines) - ICentralDatabaseService.cs 4. **Removed legacy configuration:** - DatabasePath from PodcastFeedConfig - CentralDatabasePath from PodcastFeedsConfig 5. **Deleted legacy tests** 6. **Updated documentation** (CLAUDE.md, DASHBOARD.md, README.md) ## Test Results: - All 152 tests pass - Code coverage: 77.48% line, 66.41% branch, 84.22% method ## Commits: - feat: add GetByVideoIdAsync to EpisodeRepository - feat: add PodcastDataService facade for EF Core repositories - refactor: update PodcastFeedService to use EF Core - refactor: update PlaylistWatcherService to use EF Core - refactor: update Blazor components to use EF Core - chore: delete legacy database services - chore: delete legacy database service tests and config - docs: update documentation for EF Core migration
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
joezombie/castr#65
No description provided.