mirror of
https://github.com/typeorm/typeorm.git
synced 2025-12-08 21:26:23 +00:00
docs: fix docs for UpdateDateColumn (#11572)
This commit is contained in:
parent
9cdfb20b12
commit
f3c8d2fd60
@ -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
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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
|
||||
**/
|
||||
```
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user