Home

dev / openkara

publicthedavidweng/OpenKara· sync paused
Overview Code History Branches Pull requestsIssuesInsights
main
HomeOverview Code PRsIssues

fix(cache): preserve songs.language through the legacy schema rebuild (#221)

2 months ago

c9f4e0a
Authored
Davy7/25/2026, 7:11:01 PM
migrate_legacy_song_schema recreates the songs table via CREATE
songs_new + INSERT..SELECT, but the column lists omitted `language`.
Any 0.x database that triggers the rebuild lost every per-song language
annotation, and the rebuilt table dropped the column entirely so the
follow-up list_songs SELECT failed with "no such column: language".

Add `language` to both the songs_new CREATE and the INSERT..SELECT
column lists so the value survives the rebuild, keeping the rebuilt
table's column set identical to a fresh install. `language` is nullable
(no NOT NULL constraint), so unlike audio_source_kind it needs no
COALESCE default.

Tests:
- migrate_legacy_song_schema_preserves_language: a legacy DB carrying
  language data keeps it after the rebuild and list_songs succeeds.
- legacy_rebuild_matches_fresh_install_column_set: the rebuilt songs
  column set (via PRAGMA table_info) equals a fresh install's.

Fixes #219

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

Parentf66947d

1 file changed
  • src-tauri/src/cache/mod.rs+118−0