monorepo-db#2
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the database setup by extracting it into a shared monorepo package @next-media/db, moving database-related code from server/drizzle/ to packages/db/src/ and updating all import references across the codebase.
- Moved database schema and configuration to a dedicated package at
packages/db/ - Updated all database imports to use the new
@next-media/dbpackage reference - Removed environment dependency for database file path, using a hardcoded local path instead
Reviewed Changes
Copilot reviewed 15 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| server/utils/index.ts | Updated imports to use new db package |
| server/redis/lru.ts | Updated imports to use new db package |
| server/drizzle/index.ts | Deleted original database configuration file |
| server/api/routes/user.ts | Updated imports to use new db package |
| server/api/routes/scan.ts | Updated imports to use new db package |
| server/api/routes/movie.ts | Updated imports to use new db package |
| packages/db/tsconfig.json | Added TypeScript configuration for new db package |
| packages/db/src/index.ts | New database configuration with hardcoded path |
| packages/db/package.json | Package definition for the new db package |
| packages/db/drizzle.config.ts | Updated drizzle configuration for new package structure |
| package.json | Updated dependencies and removed db scripts |
| lib/types.ts | Updated imports to use new db package |
| lib/auth.ts | Updated imports to use new db package |
| env.example | Removed DB_FILE_NAME environment variable |
| app/(dashboard)/movies/[slug]/page.tsx | Updated imports to use new db package |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| import * as schema from "./schema"; | ||
| import path from "node:path"; | ||
|
|
||
| const dbPath = path.resolve(process.cwd(), "packages/db/local.db"); |
There was a problem hiding this comment.
The hardcoded database path 'packages/db/local.db' makes the database location inflexible and could cause issues in different deployment environments. Consider using an environment variable or configuration file to make this configurable.
Suggested change
| const dbPath = path.resolve(process.cwd(), "packages/db/local.db"); | |
| const dbPath = process.env.DB_PATH | |
| ? path.resolve(process.cwd(), process.env.DB_PATH) | |
| : path.resolve(process.cwd(), "packages/db/local.db"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.