adonisjs / lucid

AdonisJS SQL ORM. Supports PostgreSQL, MySQL, MSSQL, Redshift, SQLite and many more
https://lucid.adonisjs.com/
MIT License
1.02k stars 189 forks source link

If value is DateTime in newUpIfMissing, duplicate rows are created even if the value is the same #1018

Closed adamcikado closed 1 month ago

adamcikado commented 3 months ago

Package version

20.4.0

Describe the bug

Methods updateOrCreateMany, fetchOrCreateMany and fetchOrNewUpMany use newUpIfMissing function, where it does not compare DateTime values correctly and therefore creates duplicate rows.

https://github.com/adonisjs/lucid/blob/develop/src/orm/base_model/index.ts#L212

Reproduction repo

No response