diff --git a/CHANGELOG.md b/CHANGELOG.md index e2f12e1..08b4b6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.5.2] - 2026-05-07 + +### Fixed +- Fixed a bug in the global database sync script where molds whose ID had changed upstream (but retained the same name and brand) were being duplicated rather than having their updated flight numbers merged into the existing record. + ## [0.5.1] - 2026-05-05 ### Fixed diff --git a/src/app/actions/molds.ts b/src/app/actions/molds.ts index 5f703d3..06ae9e7 100644 --- a/src/app/actions/molds.ts +++ b/src/app/actions/molds.ts @@ -36,13 +36,16 @@ export async function syncMolds() { // unless they happen to match exactly by brand/name const existing = await prisma.mold.findFirst({ where: { - id: disc.id + OR: [ + { id: disc.id }, + { name: disc.name, brand: disc.brand } + ] } }) if (existing) { await prisma.mold.update({ - where: { id: disc.id }, + where: { id: existing.id }, data: { name: disc.name, brand: disc.brand,