-
-
Notifications
You must be signed in to change notification settings - Fork 688
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1085 from drizzle-team/beta
Beta
- Loading branch information
Showing
86 changed files
with
980 additions
and
421 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ dist.new | |
.turbo | ||
.rollup.cache | ||
dist-dts | ||
rollup.config-*.mjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
- 🎉 Added SQLite simplified query API | ||
|
||
- 🎉 Added `.$defaultFn()` / `.$default()` methods to column builders | ||
|
||
You can specify any logic and any implementation for a function like `cuid()` for runtime defaults. Drizzle won't limit you in the number of implementations you can add. | ||
|
||
> Note: This value does not affect the `drizzle-kit` behavior, it is only used at runtime in `drizzle-orm` | ||
```ts | ||
import { varchar, mysqlTable } from "drizzle-orm/mysql-core"; | ||
import { createId } from '@paralleldrive/cuid2'; | ||
|
||
const table = mysqlTable('table', { | ||
id: varchar('id', { length: 128 }).$defaultFn(() => createId()), | ||
}); | ||
``` | ||
|
||
- 🎉 Added `table.$inferSelect` / `table._.inferSelect` and `table.$inferInsert` / `table._.inferInsert` for more convenient table model type inference | ||
|
||
- 🛠 Deprecated `InferModel` type in favor of more explicit `InferSelectModel` and `InferInsertModel` | ||
|
||
```ts | ||
import { InferSelectModel, InferInsertModel } from 'drizzle-orm' | ||
|
||
const usersTable = pgTable('users', { | ||
id: serial('id').primaryKey(), | ||
name: text('name').notNull(), | ||
verified: boolean('verified').notNull().default(false), | ||
jsonb: jsonb('jsonb').$type<string[]>(), | ||
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(), | ||
}); | ||
|
||
type SelectUser = typeof usersTable.$inferSelect; | ||
type InsertUser = typeof usersTable.$inferInsert; | ||
|
||
type SelectUser2 = InferSelectModel<typeof usersTable>; | ||
type InsertUser2 = InferInsertModel<typeof usersTable>; | ||
``` | ||
|
||
- 🛠 Disabled `.d.ts` files bundling | ||
- 🐛 Fixed sqlite-proxy and SQL.js response from `.get()` when the result is empty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.