Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix entities documentation #10784

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions docs/data-source-options.md
Expand Up @@ -33,9 +33,8 @@ Different RDBMS-es have their own specific options.
Use it if you want to pass extra settings to underlying database driver.

- `entities` - Entities, or Entity Schemas, to be loaded and used for this data source.
Accepts both entity classes, entity schema classes, and directories paths to load from.
Directories support glob patterns.
Example: `entities: [Post, Category, "entity/*.js", "modules/**/entity/*.js"]`.
Accepts both entity classes and entity schema classes.
Example: `entities: [Post, Category]`.
Learn more about [Entities](entities.md).
Learn more about [Entity Schemas](separating-entity-definition.md).

Expand Down
16 changes: 0 additions & 16 deletions docs/entities.md
Expand Up @@ -82,22 +82,6 @@ const myDataSource = new DataSource({
})
```

Or you can specify the whole directory with all entities inside - and all of them will be loaded:

```typescript
import { DataSource } from "typeorm"

const dataSource = new DataSource({
type: "mysql",
host: "localhost",
port: 3306,
username: "test",
password: "test",
database: "test",
entities: ["entity/*.js"],
})
```

If you want to use an alternative table name for the `User` entity you can specify it in `@Entity`: `@Entity("my_users")`.
If you want to set a base prefix for all database tables in your application you can specify `entityPrefix` in data source options.

Expand Down