EntityOptions
The options object accepted by @Entity(). See
Defining Models for the full guide, including the
string shorthand form.
type EntityOptions = Partial<
Pick<EntityMetadata, 'name' | 'schema' | 'comment' | 'tableName'>
>;
| Field | Type | Description |
|---|---|---|
tableName | string | Database table name. Defaults to the class name (ctor.name, used verbatim, no case conversion) when omitted. Equivalent to passing a bare string to @Entity('table_name'). |
schema | string | Database schema the table lives in. |
comment | string | Table comment, recorded on EntityMetadata.comment. |
name | string | Present on the type (inherited from Pick<EntityMetadata, ...>), but not read by the @Entity decorator — EntityMetadata.name always mirrors the class's own ctor.name regardless of what you pass here. |
@Entity({ tableName: 'customers', schema: 'public', comment: 'Customer accounts' })
class Customer {}
// equivalent, tableName-only shorthand
@Entity('customers')
class Customer {}