Documentation / @zerotal/orm / index / TableDecoratorBuilder
Interface: TableDecoratorBuilder()
Defined in: packages/orm/src/model/decorators/table.ts:51
A function that acts as a class decorator AND exposes chainable configuration methods. Every chain method returns the same builder so you can keep chaining or apply it directly as a decorator.
Examples
// Fluent chain form
@table("users").withoutTimestamps()
export class User extends BaseModel { ... }
// Options-object form — same result, no parens needed on the decorator
@table("users", { timestamps: true })
export class User extends BaseModel { ... }
// Non-standard primary key
@table("posts").primaryKey("post_id")
export class Post extends BaseModel { ... }
Soft deletes are opt-in via the `SoftDeletes` mixin, not `@table`:
`class Post extends BaseModelWith(SoftDeletes) {}` — see /docs/orm/lifecycle.
TableDecoratorBuilder(
target,context?):void
Defined in: packages/orm/src/model/decorators/table.ts:53
Apply the decorator to a class constructor (called automatically by TS).
Parameters
target
Function
context?
unknown
Returns
void
Methods
withTimestamps()
withTimestamps():
TableDecoratorBuilder
Defined in: packages/orm/src/model/decorators/table.ts:56
Enable automatic created_at / updated_at management. Default: on.
Returns
TableDecoratorBuilder
withoutTimestamps()
withoutTimestamps():
TableDecoratorBuilder
Defined in: packages/orm/src/model/decorators/table.ts:58
Disable automatic timestamp columns.
Returns
TableDecoratorBuilder
primaryKey()
primaryKey(
key):TableDecoratorBuilder
Defined in: packages/orm/src/model/decorators/table.ts:60
Override the primary key column name. Default: "id".
Parameters
key
string
Returns
TableDecoratorBuilder