Skip to content

Commit

Permalink
Merge pull request #120 from AthennaIO/develop
Browse files Browse the repository at this point in the history
fix(unique): if value doesnt exist, ignore
  • Loading branch information
jlenon7 authored Dec 29, 2023
2 parents b1d3d75 + 73e4423 commit 743723d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@athenna/database",
"version": "4.14.3",
"version": "4.14.4",
"description": "The Athenna database handler for SQL/NoSQL.",
"license": "MIT",
"author": "João Lenon <lenon@athenna.io>",
Expand Down
4 changes: 4 additions & 0 deletions src/models/builders/ModelQueryBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,10 @@ export class ModelQueryBuilder<
for (const column of this.schema.getAllUniqueColumns()) {
const value = data[column.name]

if (value === undefined) {
continue
}

if (isUpdate) {
const data = await this.Model.query()
.where(column.name as never, value)
Expand Down

0 comments on commit 743723d

Please sign in to comment.