mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-02 20:30:10 +00:00
Add data-migration tracking; prevent subtitle dedup
Track and run run-once SQL data migrations: entrypoint now checks _data_migrations before executing each prisma data-migration file, records successful runs, and skips already-applied scripts. Adds a Prisma DataMigration model mapped to _data_migrations and a new reset-works-table.sql migration to clear work tables for a dedup rebuild. Also improves dedup logic: extractSubtitle and subtitle-compatibility checks are added so series entries like "Series: Book A" vs "Series: Book B" are not collapsed, with accompanying unit tests for extraction and behavior.
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
-- Reset works table to fix incorrect dedup groupings (v1.1.2)
|
||||
-- Books with "Series: Title" naming (e.g. "Eden's Gate: The Reborn" vs
|
||||
-- "Eden's Gate: The Spartan") were incorrectly merged into the same work
|
||||
-- because subtitle stripping collapsed them to the same base title.
|
||||
-- The works table auto-rebuilds from dedup logic as users browse.
|
||||
DELETE FROM work_asins;
|
||||
DELETE FROM works;
|
||||
@@ -718,3 +718,15 @@ model AudibleCacheCategory {
|
||||
@@index([categoryId, rank])
|
||||
@@map("audible_cache_categories")
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// DATA MIGRATION TRACKING
|
||||
// Tracks which data migration SQL scripts have been executed (run-once).
|
||||
// ============================================================================
|
||||
|
||||
model DataMigration {
|
||||
name String @id
|
||||
executedAt DateTime @default(now()) @map("executed_at")
|
||||
|
||||
@@map("_data_migrations")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user