Skip to content

Conversation

@Perdolique
Copy link
Owner

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-b782ae1
  • drizzle-kit: 0.31.7 → 1.0.0-beta.2-b782ae1
  • drizzle-seed: 0.3.1 → 1.0.0-beta.2-b782ae1

Code Changes

  • 🔄 Relations extraction: Moved relations from schema.ts to separate relations.ts using new defineRelations API
  • Query syntax update: Updated to new object-based where and orderBy format
  • 🧹 Cleanup: Removed deprecated drizzle-orm function imports (eq, and, asc, desc, like, ilike, etc.) from API handlers
  • 🔧 Database initialization: Added relations parameter to drizzle database instances
  • 📝 Type updates: Updated middleware types for proper relation support

Files Modified

  • server/database/relations.ts (new)
  • server/database/schema.ts
  • server/middleware/database.ts
  • server/utils/database.ts
  • server/utils/admin.ts
  • server/utils/user.ts
  • server/api/checklists/[checklistId]/index.get.ts
  • server/api/checklists/[checklistId]/items/index.post.ts
  • server/api/checklists/index.get.ts
  • server/api/search/brands.get.ts
  • server/api/search/equipment.get.ts

Notes

⚠️ This is a beta version of drizzle-orm. Testing recommended before production deployment.

Copilot AI review requested due to automatic review settings December 4, 2025 20:22
@gemini-code-assist
Copy link

Summary of Changes

Hello @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

  • Drizzle ORM Upgrade: The project has been upgraded to drizzle-orm 1.0.0-beta, along with drizzle-kit and drizzle-seed to their respective beta versions, introducing significant API changes.
  • Relational Schema Definition: Relational definitions have been refactored from server/database/schema.ts into a new dedicated file, server/database/relations.ts, utilizing the new defineRelations API.
  • Query Syntax Modernization: Query construction syntax has been updated across various API handlers, transitioning from function-based where and orderBy clauses (e.g., eq, and, desc, ilike) to a new object-based format.
  • Dependency Management: The pnpm-lock.yaml file reflects numerous dependency updates and additions, including new Azure-related packages, mssql, and various utility libraries, while removing older esbuild versions.
  • Type System Enhancements: Middleware types have been updated to properly support the new relational definitions, ensuring type safety and consistency with the upgraded Drizzle ORM.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link

github-actions bot commented Dec 4, 2025

🎉 Deployed to Cloudflare!

Copy link

@gemini-code-assist gemini-code-assist bot left a 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",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

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.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a 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".

Copy link

Copilot AI left a 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.ts to separate relations.ts using new defineRelations API
  • 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants