Skip to content

Conversation

@koutyuke
Copy link
Contributor

@koutyuke koutyuke commented May 7, 2025

⭐️ Overview(概要)

Drizzleへの移行

📝 Changes Made(変更点)

  • prismaのファイルの削除
  • drizzleへの移行
    • repositoryの変更

🗺️ Scope of Impact(影響範囲)

  • api

Worning

本番環境で動くか未確認(デバック方法がわからないため)
DBのmigrationも行っていない

行う時はスナップショットを絶対にとること

@vercel
Copy link

vercel bot commented May 7, 2025

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

Name Status Preview Comments Updated (UTC)
lockerai-website ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 8, 2025 4:06am

@koutyuke koutyuke self-assigned this May 7, 2025
@koutyuke koutyuke added the ✨ feature Implementation of new features. label May 7, 2025
@koutyuke koutyuke requested a review from Copilot May 7, 2025 18:07
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 API’s database layer from Prisma to Drizzle ORM by removing old Prisma files and introducing new Drizzle schema definitions and migration scripts.

  • Removed Prisma files and related configurations
  • Added new Drizzle schema definitions for users, lost items, lockers, and drawers
  • Updated package.json scripts, migration files, and integration modules to use Drizzle ORM

Reviewed Changes

Copilot reviewed 49 out of 49 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
apps/api/src/infra/drizzle/schema/users.ts Defines the users table with Drizzle ORM using enums from _common.ts
apps/api/src/infra/drizzle/schema/lost-items.ts Defines the lost_items table, including a unique index on drawerId
apps/api/src/infra/drizzle/schema/lockers.ts Defines the lockers table
apps/api/src/infra/drizzle/schema/drawers.ts Defines the drawers table with a foreign key to lockers
apps/api/src/infra/drizzle/schema/_common.ts Provides common enums for lostAndFoundState and userRole
apps/api/src/infra/drizzle/index.ts Exports schema components
apps/api/src/infra/drizzle/drizzle.service.ts Implements the Drizzle client provider
apps/api/src/infra/drizzle/drizzle.module.ts Wraps Drizzle providers into a NestJS module
apps/api/src/common/constant/injection-token.ts Adds the DRIZZLE_CLIENT injection token
apps/api/src/app/app.module.ts Integrates DrizzleModule into the main application module
apps/api/package.json Updates DB scripts and dependencies to switch to Drizzle ORM
apps/api/drizzle/migrations/* Introduces new migration scripts and snapshots for Drizzle
apps/api/drizzle.config.ts Provides configuration for Drizzle migrations
.github/workflows/db-push-migration.yaml Removes the old Prisma migration workflow configuration
Comments suppressed due to low confidence (1)

apps/api/src/infra/drizzle/schema/lost-items.ts:25

  • The unique index on 'drawerId' may prevent multiple lost items from being associated with the same drawer. Verify that this constraint is intended or consider removing the uniqueness requirement if multiple items per drawer are allowed.
uniqueIndex('lost_items_drawer_id_key').using('btree', table.drawerId.asc().nullsLast().op('int4_ops'))

@koutyuke koutyuke linked an issue May 8, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ feature Implementation of new features.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

prismaからdrizzleへの移行

1 participant