docs: fix docs for UpdateDateColumn (#11572)

This commit is contained in:
Madhu Balakrishna 2025-09-12 12:06:14 +05:30 committed by GitHub
parent 9cdfb20b12
commit f3c8d2fd60
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 14 additions and 3 deletions

View File

@ -171,13 +171,13 @@ There are several special column types with additional functionality available:
You don't need to set this column - it will be automatically set.
- `@UpdateDateColumn` is a special column that is automatically set to the entity's update time
each time you call `save` of entity manager or repository.
each time you call `save` of entity manager or repository, or during `upsert` operations when an update occurs.
You don't need to set this column - it will be automatically set.
- `@DeleteDateColumn` is a special column that is automatically set to the entity's delete time each time you call soft-delete of entity manager or repository. You don't need to set this column - it will be automatically set. If the @DeleteDateColumn is set, the default scope will be "non-deleted".
- `@VersionColumn` is a special column that is automatically set to the version of the entity (incremental number)
each time you call `save` of entity manager or repository.
each time you call `save` of entity manager or repository, or during `upsert` operations when an update occurs.
You don't need to set this column - it will be automatically set.
## Column types

View File

@ -280,6 +280,8 @@ Special column that is automatically set to the entity's update time
each time you call `save` from entity manager or repository.
You don't need to write a value into this column - it will be automatically set.
This column is also automatically updated during `upsert` operations when an update occurs due to a conflict.
```typescript
@Entity()
export class User {
@ -310,6 +312,8 @@ Special column that is automatically set to the entity's version (incremental nu
each time you call `save` from entity manager or repository.
You don't need to write a value into this column - it will be automatically set.
This column is also automatically updated during `upsert` operations when an update occurs due to a conflict.
```typescript
@Entity()
export class User {

View File

@ -196,6 +196,8 @@ await manager.updateAll(User, { category: "ADULT" })
- `upsert` - Inserts a new entity or array of entities unless they already exist in which case they are updated instead. Supported by AuroraDataApi, Cockroach, Mysql, Postgres, and Sqlite database drivers.
When an upsert operation results in an update (due to a conflict), special columns like `@UpdateDateColumn` and `@VersionColumn` are automatically updated to their current values.
```typescript
await manager.upsert(
User,

View File

@ -152,6 +152,8 @@ await repository.updateAll({ category: "ADULT" })
- `upsert` - Inserts a new entity or array of entities unless they already exist in which case they are updated instead. Supported by AuroraDataApi, Cockroach, Mysql, Postgres, and Sqlite database drivers.
When an upsert operation results in an update (due to a conflict), special columns like `@UpdateDateColumn` and `@VersionColumn` are automatically updated to their current values.
```typescript
await repository.upsert(
[
@ -165,7 +167,10 @@ await repository.upsert(
* VALUES
* (externalId = abc123, firstName = Rizzrak),
* (externalId = cba321, firstName = Karzzir),
* ON CONFLICT (externalId) DO UPDATE firstName = EXCLUDED.firstName
* ON CONFLICT (externalId) DO UPDATE
* SET firstName = EXCLUDED.firstName,
* updatedDate = CURRENT_TIMESTAMP,
* version = version + 1
**/
```