mirror of
https://github.com/typeorm/typeorm.git
synced 2025-12-08 21:26:23 +00:00
docs: fix typos in documentation (#11713)
This commit is contained in:
parent
7c55d32321
commit
8692da2b69
@ -749,7 +749,7 @@ dropUniqueConstraint(table: Table|string, uniqueOrName: TableUnique|string): Pro
|
||||
- `table` - Table object or name
|
||||
- `uniqueOrName` - TableUnique object or unique constraint name to be dropped
|
||||
|
||||
Drops an unique constraint.
|
||||
Drops a unique constraint.
|
||||
|
||||
> Note: does not work for MySQL, because MySQL stores unique constraints as unique indices. Use `dropIndex()` method instead.
|
||||
|
||||
@ -762,7 +762,7 @@ dropUniqueConstraints(table: Table|string, uniqueConstraints: TableUnique[]): Pr
|
||||
- `table` - Table object or name
|
||||
- `uniqueConstraints` - array of TableUnique objects to be dropped
|
||||
|
||||
Drops an unique constraints.
|
||||
Drops unique constraints.
|
||||
|
||||
> Note: does not work for MySQL, because MySQL stores unique constraints as unique indices. Use `dropIndices()` method instead.
|
||||
|
||||
@ -775,7 +775,7 @@ createCheckConstraint(table: Table|string, checkConstraint: TableCheck): Promise
|
||||
- `table` - Table object or name
|
||||
- `checkConstraint` - TableCheck object
|
||||
|
||||
Creates new check constraint.
|
||||
Creates a new check constraint.
|
||||
|
||||
> Note: MySQL does not support check constraints.
|
||||
|
||||
@ -788,7 +788,7 @@ createCheckConstraints(table: Table|string, checkConstraints: TableCheck[]): Pro
|
||||
- `table` - Table object or name
|
||||
- `checkConstraints` - array of TableCheck objects
|
||||
|
||||
Creates new check constraint.
|
||||
Creates a new check constraint.
|
||||
|
||||
> Note: MySQL does not support check constraints.
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ export class User {
|
||||
|
||||
## Unique indices
|
||||
|
||||
To create an unique index you need to specify `{ unique: true }` in the index options:
|
||||
To create a unique index you need to specify `{ unique: true }` in the index options:
|
||||
|
||||
> Note: CockroachDB stores unique indices as `UNIQUE` constraints
|
||||
|
||||
@ -133,10 +133,10 @@ export class Thing {
|
||||
|
||||
## Concurrent creation
|
||||
|
||||
In order to avoid having to obtain an access exclusive lock when creating and dropping indexes in postgres, you may create them using the CONCURRENTLY modifier.
|
||||
If you want use the concurrent option, you need set `migrationsTransactionMode: none` between data source options.
|
||||
In order to avoid having to obtain an ACCESS EXCLUSIVE lock when creating and dropping indexes in Postgres, you may create them using the CONCURRENTLY modifier.
|
||||
If you want to use the concurrent option, you need to set `migrationsTransactionMode: none` in your data source options.
|
||||
|
||||
Typeorm supports generating SQL with this option if when the concurrent option is specified on the index.
|
||||
TypeORM supports generating SQL with this option when the concurrent option is specified on the index.
|
||||
|
||||
```typescript
|
||||
@Index(["firstName", "middleName", "lastName"], { concurrent: true })
|
||||
@ -146,10 +146,10 @@ For more information see the [Postgres documentation](https://www.postgresql.org
|
||||
|
||||
## Disabling synchronization
|
||||
|
||||
TypeORM does not support some index options and definitions (e.g. `lower`, `pg_trgm`) because of lot of different database specifics and multiple
|
||||
issues with getting information about exist database indices and synchronizing them automatically. In such cases you should create index manually
|
||||
(for example in the migrations) with any index signature you want. To make TypeORM ignore these indices during synchronization use `synchronize: false`
|
||||
option on `@Index` decorator.
|
||||
TypeORM does not support some index options and definitions (e.g. `lower`, `pg_trgm`) due to many database-specific differences and multiple
|
||||
issues with getting information about existing database indices and synchronizing them automatically. In such cases you should create the index manually
|
||||
(for example, in migrations) with any index signature you want. To make TypeORM ignore these indices during synchronization, use `synchronize: false`
|
||||
option on the `@Index` decorator.
|
||||
|
||||
For example, you create an index with case-insensitive comparison:
|
||||
|
||||
|
||||
@ -91,7 +91,7 @@ export class Post {
|
||||
### `@BeforeRemove`
|
||||
|
||||
You can define a method with any name in the entity and mark it with `@BeforeRemove`
|
||||
and TypeORM will call it before a entity is removed using repository/manager `remove`.
|
||||
and TypeORM will call it before an entity is removed using repository/manager `remove`.
|
||||
Example:
|
||||
|
||||
```typescript
|
||||
@ -123,7 +123,7 @@ export class Post {
|
||||
### `@BeforeSoftRemove`
|
||||
|
||||
You can define a method with any name in the entity and mark it with `@BeforeSoftRemove`
|
||||
and TypeORM will call it before a entity is soft removed using repository/manager `softRemove`.
|
||||
and TypeORM will call it before an entity is soft removed using repository/manager `softRemove`.
|
||||
Example:
|
||||
|
||||
```typescript
|
||||
@ -155,7 +155,7 @@ export class Post {
|
||||
### `@BeforeRecover`
|
||||
|
||||
You can define a method with any name in the entity and mark it with `@BeforeRecover`
|
||||
and TypeORM will call it before a entity is recovered using repository/manager `recover`.
|
||||
and TypeORM will call it before an entity is recovered using repository/manager `recover`.
|
||||
Example:
|
||||
|
||||
```typescript
|
||||
|
||||
@ -662,7 +662,7 @@ Learn more about [listeners](../advanced-topics/4-listeners-and-subscribers.md).
|
||||
#### `@BeforeRemove`
|
||||
|
||||
You can define a method with any name in the entity and mark it with `@BeforeRemove`
|
||||
and TypeORM will call it before a entity is removed using repository/manager `remove`.
|
||||
and TypeORM will call it before an entity is removed using repository/manager `remove`.
|
||||
Example:
|
||||
|
||||
```typescript
|
||||
@ -698,7 +698,7 @@ Learn more about [listeners](../advanced-topics/4-listeners-and-subscribers.md).
|
||||
#### `@BeforeSoftRemove`
|
||||
|
||||
You can define a method with any name in the entity and mark it with `@BeforeSoftRemove`
|
||||
and TypeORM will call it before a entity is soft removed using repository/manager `softRemove`.
|
||||
and TypeORM will call it before an entity is soft removed using repository/manager `softRemove`.
|
||||
Example:
|
||||
|
||||
```typescript
|
||||
@ -734,7 +734,7 @@ Learn more about [listeners](../advanced-topics/4-listeners-and-subscribers.md).
|
||||
#### `@BeforeRecover`
|
||||
|
||||
You can define a method with any name in the entity and mark it with `@BeforeRecover`
|
||||
and TypeORM will call it before a entity is recovered using repository/manager `recover`.
|
||||
and TypeORM will call it before an entity is recovered using repository/manager `recover`.
|
||||
Example:
|
||||
|
||||
```typescript
|
||||
|
||||
@ -2,12 +2,12 @@
|
||||
|
||||
## What is a QueryRunner?
|
||||
|
||||
Each new `QueryRunner` instance takes a single connection from connection pool, if RDBMS supports connection pooling.
|
||||
For databases not supporting connection pools, it uses the same connection across the entire data source.
|
||||
Each new `QueryRunner` instance takes a single connection from the connection pool, if the RDBMS supports connection pooling.
|
||||
For databases that do not support connection pools, it uses the same connection across the entire data source.
|
||||
|
||||
## Creating a new `QueryRunner` instance
|
||||
|
||||
Use `createQueryRunner` method to create a new `QueryRunner`:
|
||||
Use the `createQueryRunner` method to create a new `QueryRunner`:
|
||||
|
||||
```typescript
|
||||
const queryRunner = dataSource.createQueryRunner()
|
||||
@ -15,20 +15,20 @@ const queryRunner = dataSource.createQueryRunner()
|
||||
|
||||
## Using `QueryRunner`
|
||||
|
||||
After you create a new instance of `QueryRunner` use `connect` method to actually get a connection from the connection pool:
|
||||
After you create a new instance of `QueryRunner`, use the `connect` method to get a connection from the connection pool:
|
||||
|
||||
```typescript
|
||||
const queryRunner = dataSource.createQueryRunner()
|
||||
await queryRunner.connect()
|
||||
```
|
||||
|
||||
**Important**: make sure to release it when it is not necessary anymore to make it available to the connection pool again:
|
||||
**Important**: Make sure to release it when it is no longer needed to make it available to the connection pool again:
|
||||
|
||||
```typescript
|
||||
await queryRunner.release()
|
||||
```
|
||||
|
||||
After connection is released, it is not possible to use the query runner methods.
|
||||
After the connection is released, you cannot use the query runner's methods.
|
||||
|
||||
`QueryRunner` has a bunch of methods you can use, it also has its own `EntityManager` instance,
|
||||
which you can use through `manager` property to run `EntityManager` methods on a particular database connection
|
||||
@ -43,6 +43,6 @@ await queryRunner.connect()
|
||||
// use this particular connection to execute queries
|
||||
const users = await queryRunner.manager.find(User)
|
||||
|
||||
// remember to release connection after you are done using it
|
||||
// remember to release the connection after you are done using it
|
||||
await queryRunner.release()
|
||||
```
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user