Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency drizzle-orm to ^0.38.0 #5022

Merged
merged 1 commit into from
Dec 15, 2024
Merged

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Dec 15, 2024

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
drizzle-orm (source) ^0.37.0 -> ^0.38.0 age adoption passing confidence

Release Notes

drizzle-team/drizzle-orm (drizzle-orm)

v0.38.2

Compare Source

New features

USE INDEX, FORCE INDEX and IGNORE INDEX for MySQL

In MySQL, the statements USE INDEX, FORCE INDEX, and IGNORE INDEX are hints used in SQL queries to influence how the query optimizer selects indexes. These hints provide fine-grained control over index usage, helping optimize performance when the default behavior of the optimizer is not ideal.

Use Index

The USE INDEX hint suggests to the optimizer which indexes to consider when processing the query. The optimizer is not forced to use these indexes but will prioritize them if they are suitable.

export const users = mysqlTable('users', {
  id: int('id').primaryKey(),
  name: varchar('name', { length: 100 }).notNull(),
}, () => [usersTableNameIndex]);

const usersTableNameIndex = index('users_name_index').on(users.name);

await db.select()
  .from(users, { useIndex: usersTableNameIndex })
  .where(eq(users.name, 'David'));
Ignore Index

The IGNORE INDEX hint tells the optimizer to avoid using specific indexes for the query. MySQL will consider all other indexes (if any) or perform a full table scan if necessary.

export const users = mysqlTable('users', {
  id: int('id').primaryKey(),
  name: varchar('name', { length: 100 }).notNull(),
}, () => [usersTableNameIndex]);

const usersTableNameIndex = index('users_name_index').on(users.name);

await db.select()
  .from(users, { ignoreIndex: usersTableNameIndex })
  .where(eq(users.name, 'David'));
Force Index

The FORCE INDEX hint forces the optimizer to use the specified index(es) for the query. If the specified index cannot be used, MySQL will not fall back to other indexes; it might resort to a full table scan instead.

export const users = mysqlTable('users', {
  id: int('id').primaryKey(),
  name: varchar('name', { length: 100 }).notNull(),
}, () => [usersTableNameIndex]);

const usersTableNameIndex = index('users_name_index').on(users.name);

await db.select()
  .from(users, { forceIndex: usersTableNameIndex })
  .where(eq(users.name, 'David'));

You can also combine those hints and use multiple indexes in a query if you need

v0.38.1

Compare Source

v0.38.0

Compare Source

Types breaking changes

A few internal types were changed and extra generic types for length of column types were added in this release. It won't affect anyone, unless you are using those internal types for some custom wrappers, logic, etc. Here is a list of all types that were changed, so if you are relying on those, please review them before upgrading

  • MySqlCharBuilderInitial
  • MySqlVarCharBuilderInitial
  • PgCharBuilderInitial
  • PgArrayBuilder
  • PgArray
  • PgVarcharBuilderInitial
  • PgBinaryVectorBuilderInitial
  • PgBinaryVectorBuilder
  • PgBinaryVector
  • PgHalfVectorBuilderInitial
  • PgHalfVectorBuilder
  • PgHalfVector
  • PgVectorBuilderInitial
  • PgVectorBuilder
  • PgVector
  • SQLiteTextBuilderInitial

New Features

  • Added new function getViewSelectedFields
  • Added $inferSelect function to views
  • Added InferSelectViewModel type for views
  • Added isView function

Validator packages updates

  • drizzle-zod has been completely rewritten. You can find detailed information about it here
  • drizzle-valibot has been completely rewritten. You can find detailed information about it here
  • drizzle-typebox has been completely rewritten. You can find detailed information about it here

Thanks to @​L-Mario564 for making more updates than we expected to be shipped in this release. We'll copy his message from a PR regarding improvements made in this release:

  • Output for all packages are now unminified, makes exploring the compiled code easier when published to npm.
  • Smaller footprint. Previously, we imported the column types at runtime for each dialect, meaning that for example, if you're just using Postgres then you'd likely only have drizzle-orm and drizzle-orm/pg-core in the build output of your app; however, these packages imported all dialects which could lead to mysql-core and sqlite-core being bundled as well even if they're unused in your app. This is now fixed.
  • Slight performance gain. To determine the column data type we used the is function which performs a few checks to ensure the column data type matches. This was slow, as these checks would pile up every quickly when comparing all data types for many fields in a table/view. The easier and faster alternative is to simply go off of the column's columnType property.
  • Some changes had to be made at the type level in the ORM package for better compatibility with drizzle-valibot.

And a set of new features

  • createSelectSchema function now also accepts views and enums.
  • New function: createUpdateSchema, for use in updating queries.
  • New function: createSchemaFactory, to provide more advanced options and to avoid bloating the parameters of the other schema functions

Bug fixes


Configuration

📅 Schedule: Branch creation - "on sunday before 6:00am" in timezone UTC, Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot added the dependencies Pull requests that update a dependency file label Dec 15, 2024
Copy link

vercel bot commented Dec 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lobe-chat-database ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 15, 2024 1:10am
lobe-chat-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 15, 2024 1:10am

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Dec 15, 2024
@lobehubbot
Copy link
Member

👍 @renovate[bot]

Thank you for raising your pull request and contributing to our Community
Please make sure you have followed our contributing guidelines. We will review it as soon as possible.
If you encounter any problems, please feel free to connect with us.
非常感谢您提出拉取请求并为我们的社区做出贡献,请确保您已经遵循了我们的贡献指南,我们会尽快审查它。
如果您遇到任何问题,请随时与我们联系。

Copy link

codecov bot commented Dec 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.97%. Comparing base (8df3212) to head (cfb9ffa).
Report is 13 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##             main    #5022     +/-   ##
=========================================
  Coverage   91.97%   91.97%             
=========================================
  Files         548      548             
  Lines       41352    41352             
  Branches     3708     2357   -1351     
=========================================
  Hits        38032    38032             
  Misses       3320     3320             
Flag Coverage Δ
app 91.97% <ø> (ø)
server 98.12% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lobehubbot
Copy link
Member

❤️ Great PR @renovate[bot] ❤️

The growth of project is inseparable from user feedback and contribution, thanks for your contribution! If you are interesting with the lobehub developer community, please join our discord and then dm @arvinxx or @canisminor1990. They will invite you to our private developer channel. We are talking about the lobe-chat development or sharing ai newsletter around the world.
项目的成长离不开用户反馈和贡献,感谢您的贡献! 如果您对 LobeHub 开发者社区感兴趣,请加入我们的 discord,然后私信 @arvinxx@canisminor1990。他们会邀请您加入我们的私密开发者频道。我们将会讨论关于 Lobe Chat 的开发,分享和讨论全球范围内的 AI 消息。

@lobehubbot
Copy link
Member

🎉 This PR is included in version 1.36.26 🎉

The release is available on:

Your semantic-release bot 📦🚀

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 released size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants