Skip to content

monorepo-db#2

Merged
hidaviddong merged 1 commit into
mainfrom
feat/monorepo-db
Sep 1, 2025
Merged

monorepo-db#2
hidaviddong merged 1 commit into
mainfrom
feat/monorepo-db

Conversation

@hidaviddong

Copy link
Copy Markdown
Owner

No description provided.

@hidaviddong
hidaviddong requested a review from Copilot September 1, 2025 04:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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/db package 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.

Comment thread packages/db/src/index.ts
import * as schema from "./schema";
import path from "node:path";

const dbPath = path.resolve(process.cwd(), "packages/db/local.db");

Copilot AI Sep 1, 2025

Copy link

Choose a reason for hiding this comment

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

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");

Copilot uses AI. Check for mistakes.
Comment thread packages/db/drizzle.config.ts
@hidaviddong
hidaviddong merged commit 5fcce02 into main Sep 1, 2025
1 check passed
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