0.27.0
版本发布时间: 2023-06-17 14:54:22
drizzle-team/drizzle-orm最新发布版本:0.34.1(2024-10-08 04:07:09)
Correct behavior when installed in a monorepo (multiple Drizzle instances)
Replacing all instanceof
statements with a custom is()
function allowed us to handle multiple Drizzle packages interacting properly.
It also fixes one of our biggest Discord tickets: maximum call stack exceeded
🎉
You should now use is()
instead of instanceof
to check if specific objects are instances of specific Drizzle types. It might be useful if you are building something on top of the Drizzle API.
import { is, Column } from 'drizzle-orm'
if (is(value, Column)) {
// value's type is narrowed to Column
}
distinct
clause support
await db.selectDistinct().from(usersDistinctTable).orderBy(
usersDistinctTable.id,
usersDistinctTable.name,
);
Also, distinct on
clause is available for PostgreSQL:
await db.selectDistinctOn([usersDistinctTable.id]).from(usersDistinctTable).orderBy(
usersDistinctTable.id,
);
await db.selectDistinctOn([usersDistinctTable.name], { name: usersDistinctTable.name }).from(
usersDistinctTable,
).orderBy(usersDistinctTable.name);
bigint
and boolean
support for SQLite
Contributed by @MrRahulRamkumar (#558), @raducristianpopa (#411) and @meech-ward (#725)
const users = sqliteTable('users', {
bigintCol: blob('bigint', { mode: 'bigint' }).notNull(),
boolCol: integer('bool', { mode: 'boolean' }).notNull(),
});
DX improvements
- Added verbose type error when relational queries are used on a database type without a schema generic
- Fix
where
callback in RQB for tables without relations
Various docs improvements
- Fix joins docs typo (#522) by @arjunyel
- Add Supabase guide to readme (#690) by @saltcod
- Make the column type in sqlite clearer (#717) by @shairez
1、 drizzle-orm-0.27.0-dist.tgz 317.12KB