-
Notifications
You must be signed in to change notification settings - Fork 0
feat: upgrade to drizzle-orm 1.0.0-beta #512
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
base: master
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @Perdolique, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request undertakes a significant migration to Drizzle ORM's 1.0.0-beta version, which involves a comprehensive refactoring of the database interaction layer. The primary goal is to align the codebase with the new relational query API and syntax, enhancing maintainability and leveraging the latest features of the ORM. This update touches core database schema definitions, query patterns in API endpoints, and related tooling. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
🎉 Deployed to Cloudflare!
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request upgrades drizzle-orm to a beta version and refactors the code to use the new relational query API and syntax. The changes are well-executed, with relations correctly extracted to a separate file and query syntax updated in most places. However, I've found a critical issue in package.json where drizzle-orm has been moved to devDependencies. Since it's a runtime dependency for your server-side code, it must be in dependencies to be available in production.
| "drizzle-kit": "0.31.8", | ||
| "drizzle-seed": "0.3.1", | ||
| "drizzle-kit": "1.0.0-beta.2-b782ae1", | ||
| "drizzle-orm": "1.0.0-beta.2-b782ae1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The drizzle-orm package is used at runtime in your server-side API handlers. It should be listed under dependencies, not devDependencies, to ensure it's included in the production build. Moving it to devDependencies could cause your application to fail in production because the package won't be installed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR migrates the codebase from drizzle-orm 0.44.7 to 1.0.0-beta.2-b782ae1, introducing significant API changes including a new relational query API and object-based query syntax.
Key Changes:
- Migrated from function-based to object-based query syntax (
where,orderBy) - Extracted relations from
schema.tsto separaterelations.tsusing newdefineRelationsAPI - Updated all database query operations across API handlers and utilities
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
server/database/relations.ts |
New file defining database relations using defineRelations API - has critical issues with missing relations |
server/database/schema.ts |
Removed old relations definitions (130+ lines) |
server/utils/database.ts |
Added relations import and parameter to drizzle instances |
server/middleware/database.ts |
Updated type signature to include relations |
server/utils/user.ts |
Updated query syntax to object-based format |
server/utils/admin.ts |
Updated query syntax and removed drizzle-orm function imports |
server/api/search/equipment.get.ts |
Updated query syntax to object-based format |
server/api/search/brands.get.ts |
Updated query syntax and removed imports |
server/api/checklists/index.get.ts |
Updated query syntax and removed imports |
server/api/checklists/[checklistId]/index.get.ts |
Updated query syntax |
server/api/checklists/[checklistId]/items/index.post.ts |
Updated query syntax and added return types |
package.json |
Updated drizzle packages to beta versions, added db:drizzle script |
nuxt.config.ts |
Removed typescriptPlugin: true from experimental features |
pnpm-lock.yaml |
Updated dependencies for drizzle-orm beta migration |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- 🔄 Migrate relations from schema.ts to separate `relations.ts` using new `defineRelations` API - ✨ Update query syntax to new object-based `where` and `orderBy` format - 🧹 Remove deprecated drizzle-orm function imports (`eq`, `and`, `asc`, etc.) from API handlers - 🔧 Add `relations` parameter to drizzle database initialization - 📝 Update middleware types for proper relation support - 🛡️ Fix null check for equipment in checklist store - 📦 `drizzle-orm`: 0.44.7 -> 1.0.0-beta.2-b782ae1 - 📦 `drizzle-kit`: 0.31.7 -> 1.0.0-beta.2-b782ae1 - 📦 `drizzle-seed`: 0.3.1 -> 1.0.0-beta.2-b782ae1
118c4bb to
711f925
Compare
Summary
Migration to drizzle-orm 1.0.0-beta with new relational query API and syntax updates.
Changes
Package Updates
drizzle-orm: 0.44.7 → 1.0.0-beta.2-b782ae1drizzle-kit: 0.31.7 → 1.0.0-beta.2-b782ae1drizzle-seed: 0.3.1 → 1.0.0-beta.2-b782ae1Code Changes
schema.tsto separaterelations.tsusing newdefineRelationsAPIwhereandorderByformateq,and,asc,desc,like,ilike, etc.) from API handlersrelationsparameter to drizzle database instancesFiles Modified
server/database/relations.ts(new)server/database/schema.tsserver/middleware/database.tsserver/utils/database.tsserver/utils/admin.tsserver/utils/user.tsserver/api/checklists/[checklistId]/index.get.tsserver/api/checklists/[checklistId]/items/index.post.tsserver/api/checklists/index.get.tsserver/api/search/brands.get.tsserver/api/search/equipment.get.tsNotes