Skip to content

nightly-3b34ac8c-ls26

Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 25 Nov 12:15
· 3 commits to nightly since this release

CI

Test report · Build status

LinuxServer changes

Full Changelog: nightly-458390ea-ls25...nightly-3b34ac8c-ls26

Upstream changes

Source: beetbox/beets@3b34ac8

Fix empty db migration backup (#7171)

Description

Fixes #7170.

When beets creates a new library, it runs every migration on the fresh
database,
and each one made a backup first. A brand-new, empty library ended up
with 11
.bak files and 11 "Created database backup" lines, even for beet version.

This PR makes _before_migration_backup in beets/dbcore/db.py skip
the
backup when the table being migrated has no rows (SELECT 1 FROM <table> LIMIT 1).
An empty table has no data for a migration to change, so there's nothing
to
protect. The migrations still run and are still recorded, so they won't
be
retried on the next start.

Tables that contain data are backed up exactly as before.

Before: fresh BEETSDIR + beet version → 11 .bak files.
After: fresh BEETSDIR + beet version → 0 .bak files, 11
migrations recorded.

To Do

  • Documentation. (bug fix, no user-facing option changes)
  • Changelog.
  • Tests. Added test_no_backup_for_empty_table to
    TestMigrationBackup. It
    fails without the fix and passes with it; the existing
    test_backup_config
    (which expects one backup when the table has data) still passes.

poe lint, poe check-format and poe lint-docs pass. The full test
suite
passes locally except test_importfeeds.py::test_link_creates_symlink,
which
also fails on unmodified master on Windows (symlinks need admin or
Developer
Mode) and is unrelated.


AI disclosure: An AI assistant (Claude) helped me find and reproduce
this bug,
explained the code, suggested the approach, and drafted this
description. I
wrote the code change and the test myself and can answer questions about
them.