Function: Table()
Table(
tableName,options?):ClassDecorator
Defined in: src/decorators/Table.ts:22
Class decorator mapping an entity class to a specific database table name and schema.
Parameters
| Parameter | Type | Description |
|---|---|---|
tableName | string | Name of the table in the database. |
options? | TableOptions | Optional table settings (e.g. database schema name). |
Returns
ClassDecorator
Usecase
Explicitly define the database table name and schema rather than defaulting to class name.
Example
@Table('users', { schema: 'public' })
export class User {
@PrimaryKey()
id!: number;
}