Skip to content

v0.3.0

Choose a tag to compare

@wrsouza wrsouza released this 08 Jun 16:58
· 15 commits to main since this release

What's Changed

@uuid() decorator — new preferred way to declare UUID primary keys

Replace the HasUuids(Model) mixin with the @uuid() property decorator:

// before
class User extends HasUuids(Model) {
  declare id: string;
}

// after
class User extends Model {
  @uuid()
  declare id: string;
}
  • Sets incrementing: false and keyType: 'string' automatically
  • Apply to multiple fields to generate UUIDs for extra columns
  • HasUuids and HasUlids are still available for advanced use (custom generator via newUniqueId())

@table() now accepts a plain string

// before
@table({ name: 'users', primaryKey: 'id', incrementing: false, keyType: 'string' })

// after
@table('users')

Pass an object only when you need extra options (primaryKey, timestamps, connection, etc.).

@fillable removed

TypeScript's type system enforces mass-assignment at compile time — a runtime allowlist adds no safety in a typed codebase. Remove @fillable and @guarded from your models. Use @hidden to exclude sensitive fields from JSON serialization.

@map() formatting

The @map('column_name') decorator now sits on its own line above declare:

@map('created_at')
declare createdAt: Date;

Breaking changes

  • @fillable and @guarded are no longer exported. Remove them from your models and imports.
  • HasUuids(Model) pattern is superseded by @uuid(). HasUuids remains exported for backwards compatibility but is no longer documented.