An operation failed because it depends on one or more records that were required but not found. Record to update not found. 에러
상황: 브라우저에서 테스트 후 vscode에서 테스트 중 이런 에러를 만났다.
찾아보니 prisma에서 update시 수정할려고 하는 값이 존재 하지 않으면 저런 에러가 나온다고 한다.
update 같은 경우 해당 값을 SELECT 해온다음에 UPDATE를 처리하는데
SELECT하였을때 값이 없으면 위의 에러값을 던지는 것입니다.
하지만 updateMany는 SELECT 하지 않고 바로 UPDATE를 합니다.
그래서 에러가 발생하지 않습니다.
참고 블로그
prisma - update error : An operation failed because it depends on one or more records that were required but not found. Record t
간단요약 update 대신 updateMany를 사용하면 됩니다. "An operation failed because it depends on one or more records that were required but not found. Record to update not found. " prisma에서 update시 수정할려고 하는 값이 존재 하
chilldaysofmine.tistory.com
https://github.com/prisma/prisma/issues/10142
'TIL' 카테고리의 다른 글
23/12/19 TIL __ typeScript 탄생 배경 및 파일 설정 옵션들 (0) | 2023.12.19 |
---|---|
23/12/18 TIL __ 백오피스 프로젝트 끝 (0) | 2023.12.18 |
23/12/14 __ TIL 프리즈마에서 날짜 데이터 다룰때 (0) | 2023.12.14 |
23/12/13 __ TIL DB 테이블 설계하기 (0) | 2023.12.14 |
23/12/12 TIL __ 정렬 알고리즘 (0) | 2023.12.12 |