Skip to content

Release v0.4.3: Implement soft delete for books to preserve purchase history integrity

Pre-release
Pre-release

Choose a tag to compare

@devsmish devsmish released this 12 Sep 06:58
· 21 commits to main since this release
de930e5

🛠️ Feature Enhancements & Data Integrity

Soft Delete for Books: Replaced hard DELETE queries with soft deletion (deleted_at DATETIME NULL), preventing physical row removals and ensuring historical purchase logs (JOIN purchases + books) remain intact.

Catalog Query Isolation: Updated BookRepository queries (get_all, search, get_by_id, update, decrease_stock) to filter against deleted_at IS NULL, hiding soft-deleted items from user browsing and purchasing.

Admin Book Restoration: Introduced get_deleted() and restore() in BookRepository and AdminService, adding 5. Restore deleted book to the admin menu for auditing and restoring soft-deleted titles.

Upsert Isolation on Import: Standardized file import (upsert_by_title_author) to ignore soft-deleted records, creating new active entries rather than modifying deleted rows.

⚠️ Schema & Migration Requirements

Database Migration: Added ALTER TABLE books ADD COLUMN IF NOT EXISTS deleted_at DATETIME NULL DEFAULT NULL to database.py. Requires MySQL ≥ 8.0.29 or MariaDB ≥ 10.0.2.

Full Changelog: v0.4.2...v0.4.3