Skip to main content

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​

ParameterTypeDescription
tableNamestringName of the table in the database.
options?TableOptionsOptional 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;
}