Stop being the product.
Become the owner.
or
sign uplog in

MikroORM 7.2: row level security, to-one relations through…

MikroORM 7.2: row level security, to-one relations through a pivot, sql.js driver with a live docs playground, cursor pagination rework, and more

MikroORM 7.2 is out https://mikro-orm.io/blog/mikro-orm-7-2-released — the second minor on top of v7.

New features:

* Row level security https://mikro-orm.io/docs/row-level-security — PostgreSQL policies as entity metadata, created and diffed by the schema generator, with per-request session context pushed down to the connection; an existing `@Filter` can compile into a policy, so one declaration enforces at both layers
* `through` option for to-one relations https://mikro-orm.io/docs/relationships#to-one-relations-through-another-entity — resolve a M:1 / 1:1 via a correlated subquery on a pivot entity, or pick a single row out of a to-many relation (e.g. the latest one) without loading the collection
* sql.js driver https://mikro-orm.io/docs/usage-with-sql-js — SQLite compiled to WebAssembly, in memory, in the browser, Node.js, Bun and Deno with no native bindings. It also powers the new live playground in the getting-started guide, so the code in the docs runs against a real database as you read it
* Cursor pagination rework https://mikro-orm.io/docs/entity-manager#cursor-based-pagination — a new optional `Type.fromJSON()` https://mikro-orm.io/docs/custom-types lets a custom type own its cursor wire format (sub-millisecond precision survives), and nullable sort keys now make the emitted `order by` and the keyset condition agree on where nulls sit
* Named parameters in `em.execute()` https://mikro-orm.io/docs/raw-queries#named-parameters — `:name` for values, `:name:` for identifiers, as an alternative to the positional array
* String normalization https://mikro-orm.io/docs/custom-types#normalizing-string-properties — opt-in trim and casing on `StringType` / `TextType`, applied on writes and query parameters
* `getNativeClient()` https://mikro-orm.io/docs/configuration#accessing-the-native-client — reach the underlying client for vendor APIs the ORM doesn't wrap: `pg` `Pool`, `mysql2` `Pool`, `better-sqlite3` / `libsql` `Database`, the `PGlite` instance, `MongoClient`
* `await using` support https://mikro-orm.io/docs/quick-start#closing-the-orm — the ORM instance implements `Symbol.asyncDispose`, so the connection closes with the enclosing scope
* `index` option on M:N properties https://mikro-orm.io/docs/collections#indexing-pivot-table-join-columns — index the generated pivot table's join columns, which had no override on PostgreSQL before
* Nub TypeScript loader https://mikro-orm.io/docs/typescript-loaders for the CLI, selected explicitly via `tsLoader`
* ` em.map ()` can bypass the identity map https://mikro-orm.io/docs/entity-manager#disabling-identity-map-and-change-set-tracking — map raw rows to entities without touching the current context
* Per-instance options callback for `RequestContext.create()` https://mikro-orm.io/docs/identity-map#adding-additional-options-to-the-fork — different fork options per ORM instance
* `migrations.snapshotOnMigrate` https://mikro-orm.io/docs/migrations#snapshots — keep the snapshot managed solely by `migration:create` instead of rewriting it from the database on migrate
* CLI `-q` to suppress informational output, and `cache:generate --combined` now takes a path

Full blog post: https://mikro-orm.io/blog/mikro-orm-7-2-released
Changelog: https://github.com/mikro-orm/mikro-orm/releases/tag/v7.2.0

Happy to answer any questions!
#programming #dev #js #technology
loved
1
laughed
1
shocked
1
sad
1
angry
1
not impressed
1
earnings
10,000 mlx total
$0  total
engagement
9 views
6 reactions

0 comments