Skip to content

Commit

Permalink
docs: add documentation for .orIgnore method (#10607)
Browse files Browse the repository at this point in the history
  • Loading branch information
alenap93 committed Jan 26, 2024
1 parent 99d8249 commit 032f535
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/insert-query-builder.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,24 @@ await dataSource
.execute()
```

### IGNORE error (MySQL) or DO NOTHING (Postgres) during insert

If the values you are trying to insert conflict due to existing data or containing invalid data, the `orIgnore` function can be used to suppress errors and insert only rows that contain valid data.

```typescript
await dataSource
.createQueryBuilder()
.insert()
.into(User)
.values({
firstName: "Timber",
lastName: "Saw",
externalId: "abc123",
})
.orIgnore()
.execute()
```

### Skip data update if values have not changed (Postgres)

```typescript
Expand Down

0 comments on commit 032f535

Please sign in to comment.