adonisjs / lucid

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

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

Closed adamcikado closed 6 months ago

adamcikado commented 8 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