MikroORM 6.6 Released with Enhanced Filter Control and Generator Improvements

MikroORM 6.6 has been released, bringing significant improvements to relation filters, entity generation, and developer experience. This update introduces more granular control over how filters interact with relations and expands the entity generator with new output formats.
Granular Filter Control on Relations
The biggest feature in this release is enhanced control over relation filters through decorator options. Developers can now disable all filters on a relation with @ManyToOne({ filters: false }), disable specific filters, or pass custom filter parameters directly through the decorator.
For teams that prefer the previous behavior, a global configuration option filtersOnRelations: false allows disabling this feature entirely.
Strict Relation Filters
A new strict option for filters on nullable relations changes how the ORM handles discarded values. When enabled, if a nullable relation is discarded by a filter, the owning entity is also discarded. This is particularly useful for tenant filtering scenarios where you want to ensure data isolation.
Entity Generator Enhancements
The entity generator receives major upgrades in this release:
- Flexible output formats: Choose between decorators, defineEntity helper, or entity schema through the new
entityDefinitionoption - InferEntity type support: Generate type definitions instead of classes with the
inferEntityTypeoption - Enhanced enum handling: Control enum output as TypeScript enums, dictionaries, or union types
- PostgreSQL native enums: Now fully supported and emitted to separate files
QueryBuilder and Raw Helper Support
SQL drivers now provide enhanced raw helper support that accepts QueryBuilder and Knex.QueryBuilder instances, enabling strictly-typed queries with better IDE support and type safety.
Performance Optimizations
The select-in loading strategy now properly hydrates filtered relations to null instead of leaving them uninitialized. Additionally, pessimistic lock queries automatically exclude left-joined nullable relations, resolving dialect-specific restrictions without manual configuration.
This release also addresses several filter-related issues from version 6.5, particularly around nullable relations and soft-delete behavior.