Skip to content

Bump drizzle-orm from 0.27.2 to 0.29.0#20

Closed
dependabot[bot] wants to merge 1 commit intomainfrom
dependabot/npm_and_yarn/drizzle-orm-0.29.0
Closed

Bump drizzle-orm from 0.27.2 to 0.29.0#20
dependabot[bot] wants to merge 1 commit intomainfrom
dependabot/npm_and_yarn/drizzle-orm-0.29.0

Conversation

@dependabot
Copy link

@dependabot dependabot bot commented on behalf of github Nov 13, 2023

Bumps drizzle-orm from 0.27.2 to 0.29.0.

Release notes

Sourced from drizzle-orm's releases.

0.29.0

Drizzle ORM version 0.29.0 will require a minimum Drizzle Kit version of 0.20.0, and vice versa. Therefore, when upgrading to a newer version of Drizzle ORM, you will also need to upgrade Drizzle Kit. This may result in some breaking changes throughout the versions, especially if you need to upgrade Drizzle Kit and your Drizzle ORM version is older than <0.28.0

New Features

🎉 MySQL unsigned option for bigint

You can now specify bigint unsigned type

const table = mysqlTable('table', {
  id: bigint('id', { mode: 'number', unsigned: true }),
});

Read more in docs

🎉 Improved query builder types

Starting from 0.29.0 by default, as all the query builders in Drizzle try to conform to SQL as much as possible, you can only invoke most of the methods once. For example, in a SELECT statement there might only be one WHERE clause, so you can only invoke .where() once:

const query = db
  .select()
  .from(users)
  .where(eq(users.id, 1))
  .where(eq(users.name, 'John')); // ❌ Type error - where() can only be invoked once

This behavior is useful for conventional query building, i.e. when you create the whole query at once. However, it becomes a problem when you want to build a query dynamically, i.e. if you have a shared function that takes a query builder and enhances it. To solve this problem, Drizzle provides a special 'dynamic' mode for query builders, which removes the restriction of invoking methods only once. To enable it, you need to call .$dynamic() on a query builder.

Let's see how it works by implementing a simple withPagination function that adds LIMIT and OFFSET clauses to a query based on the provided page number and an optional page size:

function withPagination<T extends PgSelect>(
  qb: T,
  page: number,
  pageSize: number = 10,
) {
  return qb.limit(pageSize).offset(page * pageSize);
}
const query = db.select().from(users).where(eq(users.id, 1));
withPagination(query, 1); // ❌ Type error - the query builder is not in dynamic mode
const dynamicQuery = query.$dynamic();
withPagination(dynamicQuery, 1); // ✅ OK

Note that the withPagination function is generic, which allows you to modify the result type of the query builder inside it, for example by adding a join:

... (truncated)

Commits
  • 0d833d1 Merge pull request #1484 from drizzle-team/beta
  • a6dc062 Fix Cloudflare
  • 4227a46 Fix changelogs for 0.29.0
  • d3b1c58 Update api version to 6
  • 0a8127c Merge pull request #1468 from drizzle-team/fix-imports
  • 99ce577 timeout to 100 sec in vitest
  • f6d20a1 Add 60 sec timeout for vitest
  • 9cbf8c9 Merge branch 'beta' of github.com:drizzle-team/drizzle-orm into fix-imports
  • 3822b1c Add schema to extractTablesRelationalConfig function
  • 6d0c2c0 Fix cycle imports
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps [drizzle-orm](https://github.com/drizzle-team/drizzle-orm) from 0.27.2 to 0.29.0.
- [Release notes](https://github.com/drizzle-team/drizzle-orm/releases)
- [Commits](drizzle-team/drizzle-orm@0.27.2...0.29.0)

---
updated-dependencies:
- dependency-name: drizzle-orm
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot added the dependencies Pull requests that update a dependency file label Nov 13, 2023
@dependabot @github
Copy link
Author

dependabot bot commented on behalf of github Dec 4, 2023

Superseded by #25.

@dependabot dependabot bot closed this Dec 4, 2023
@dependabot dependabot bot deleted the dependabot/npm_and_yarn/drizzle-orm-0.29.0 branch December 4, 2023 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants