-
Notifications
You must be signed in to change notification settings - Fork 2
feat(db): Migrate from Prisma to Drizzle ORM #95
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
cf111bc
feat(db): migrate from Prisma to Drizzle ORM
ng 7366499
fix(db): address CodeRabbit review comments
ng 2dc4a6d
fix(lint): address ESLint style violations and document review process
ng 440a0d4
ci: remove Prisma references from workflows
ng 0e8f5b2
chore: update .gitignore for Drizzle ORM
ng 57f2a83
chore: make .gitignore more specific for SQLite databases
ng 6cfb6ba
refactor: use .dev.db suffix for local development database
ng 3fae491
fix(types): remove explicit JSX.Element type annotations
ng File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| --- | ||
| model: claude-haiku-4-5 | ||
| --- | ||
|
|
||
| Review the current branch's diff against the base branch and update the GitHub PR with a clear title and description. | ||
|
|
||
| ## Instructions | ||
|
|
||
| 1. Determine the current branch and its base branch (usually `develop`). Run: | ||
| - `gh pr view --json number,title,body,baseRefName` to get the existing PR number and base branch | ||
| - `git log --oneline develop..HEAD` to see all commits on this branch | ||
| - `git diff develop...HEAD --stat` to see which files changed and by how much | ||
|
|
||
| **Token-saving rule:** Do NOT read the full diff (`git diff` without `--stat`). Commit messages + stat summary are sufficient. Only read the full diff for a specific file if the commit messages are unclear about what changed there. | ||
|
|
||
| 2. Analyze the commit messages and file stats. Focus on **intent and impact**, not just file names. | ||
|
|
||
| 3. Generate a PR title using conventional commits style: | ||
| - `feat:`, `fix:`, `chore:`, `refactor:`, `test:`, `docs:` | ||
| - Keep it under 70 characters | ||
| - Be specific about the scope, e.g. `feat(auth): support magic link login` | ||
|
|
||
| 4. Generate a PR body using this exact structure: | ||
|
|
||
| ``` | ||
| ## Summary | ||
|
|
||
| - Bullet point summary of major changes | ||
| - Focus on *what* changed and *why* | ||
| - Use emojis sparingly to improve scannability | ||
|
|
||
| ## Scope Breakdown | ||
|
|
||
| | Area | Summary | | ||
| |------|---------| | ||
| | relevant/path/ | Brief description of changes in that area | | ||
|
|
||
| ## Test plan | ||
|
|
||
| - [ ] Checklist of what should be tested | ||
| ``` | ||
|
|
||
| 5. Update the PR using `gh pr edit <number> --title "..." --body "..."`. Use a HEREDOC for the body to preserve formatting. | ||
|
|
||
| 6. Return the PR URL when done. | ||
|
|
||
| **Rules:** | ||
| - Never fabricate changes — only describe what's in the diff | ||
| - If there's no open PR for the current branch, inform the user instead of creating one | ||
| - Keep the summary concise (3-8 bullet points) | ||
| - Only include the Scope Breakdown table if changes span 2+ distinct areas | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,245 @@ | ||
| # CI Checks - Run Locally Before Pushing | ||
|
|
||
| This document describes the continuous integration (CI) checks that run on every pull request, and how to run them locally to catch issues before pushing. | ||
|
|
||
| ## Overview | ||
|
|
||
| Our GitHub Actions CI workflow runs three checks on every PR. You should run all of these locally before pushing to ensure your changes will pass CI. | ||
|
|
||
| ## The Three Checks | ||
|
|
||
| ### 1. Lint | ||
| Checks code style and catches common errors using ESLint. | ||
|
|
||
| ```bash | ||
| pnpm lint | ||
| ``` | ||
|
|
||
| **What it checks:** | ||
| - Code style violations | ||
| - Unused variables | ||
| - Import/export issues | ||
| - JSX formatting | ||
| - TypeScript ESLint rules | ||
|
|
||
| **Auto-fix many issues:** | ||
| ```bash | ||
| pnpm lint --fix | ||
| ``` | ||
|
|
||
| ### 2. TypeScript Type Check | ||
| Verifies all TypeScript types are correct. | ||
|
|
||
| ```bash | ||
| pnpm tsc | ||
| ``` | ||
|
|
||
| **What it checks:** | ||
| - Type errors | ||
| - Missing types | ||
| - Incorrect type usage | ||
| - JSX type issues | ||
| - Module resolution | ||
|
|
||
| **Note:** This runs `tsc --noEmit`, so it only checks types without generating output files. | ||
|
|
||
| ### 3. Unit Tests | ||
| Runs all unit tests with coverage reporting. | ||
|
|
||
| ```bash | ||
| pnpm test run --coverage --passWithNoTests | ||
| ``` | ||
|
|
||
| **What it checks:** | ||
| - All test files pass | ||
| - Code coverage meets thresholds | ||
| - No test failures or errors | ||
|
|
||
| **For development (watch mode):** | ||
| ```bash | ||
| pnpm test | ||
| ``` | ||
|
|
||
| ## Run All Checks at Once | ||
|
|
||
| To run all three checks sequentially (mimicking CI): | ||
|
|
||
| ```bash | ||
| pnpm lint && pnpm tsc && pnpm test run --coverage --passWithNoTests | ||
| ``` | ||
|
|
||
| Or create a convenient npm script in `package.json`: | ||
|
|
||
| ```json | ||
| { | ||
| "scripts": { | ||
| "ci": "pnpm lint && pnpm tsc && pnpm test run --coverage --passWithNoTests" | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Then run: | ||
| ```bash | ||
| pnpm ci | ||
| ``` | ||
|
|
||
| ## Pre-Push Checklist | ||
|
|
||
| Before pushing commits or creating a PR, verify: | ||
|
|
||
| - [ ] `pnpm lint` passes (or run with `--fix` to auto-fix) | ||
| - [ ] `pnpm tsc` passes with no type errors | ||
| - [ ] `pnpm test run --coverage --passWithNoTests` passes | ||
| - [ ] All files are properly formatted | ||
| - [ ] No uncommitted changes (unless intentional) | ||
|
|
||
| ## Common Issues and Fixes | ||
|
|
||
| ### Lint Failures | ||
|
|
||
| **Problem:** ESLint errors block CI | ||
| ``` | ||
| error: 'foo' is assigned a value but never used (@typescript-eslint/no-unused-vars) | ||
| ``` | ||
|
|
||
| **Fix:** Either use the variable or remove it. Run `pnpm lint --fix` for auto-fixable issues. | ||
|
|
||
| ### TypeScript Errors | ||
|
|
||
| **Problem:** Type check fails | ||
| ``` | ||
| error TS2503: Cannot find namespace 'JSX'. | ||
| ``` | ||
|
|
||
| **Fix:** | ||
| - Ensure proper imports (e.g., React for JSX) | ||
| - Remove explicit type annotations if TypeScript can infer | ||
| - Add missing type definitions | ||
|
|
||
| ### Test Failures | ||
|
|
||
| **Problem:** Tests fail locally but you're not sure why | ||
|
|
||
| **Fix:** | ||
| ```bash | ||
| # Run tests in watch mode to debug | ||
| pnpm test | ||
|
|
||
| # Run specific test file | ||
| pnpm test path/to/test.spec.ts | ||
|
|
||
| # Run with verbose output | ||
| pnpm test run --reporter=verbose | ||
| ``` | ||
|
|
||
| ## CI Configuration | ||
|
|
||
| The actual CI configuration is in `.github/workflows/test.yml`: | ||
|
|
||
| ```yaml | ||
| matrix: | ||
| task: | ||
| - { name: "Lint", cmd: "pnpm lint" } | ||
| - { name: "Typecheck", cmd: "pnpm tsc" } | ||
| - { name: "Unit Tests", cmd: "pnpm test run --coverage --passWithNoTests" } | ||
| ``` | ||
|
|
||
| **Important:** Always keep your local checks in sync with the CI configuration. If the CI commands change, update this document and your local workflow. | ||
|
|
||
| ## Git Hooks (Optional) | ||
|
|
||
| Consider setting up git hooks to automatically run checks: | ||
|
|
||
| ### Pre-commit Hook | ||
| Run lint and type check before allowing commits: | ||
|
|
||
| ```bash | ||
| # .git/hooks/pre-commit | ||
| #!/bin/sh | ||
| pnpm lint && pnpm tsc | ||
| ``` | ||
|
|
||
| ### Pre-push Hook | ||
| Run all checks before pushing: | ||
|
|
||
| ```bash | ||
| # .git/hooks/pre-push | ||
| #!/bin/sh | ||
| pnpm lint && pnpm tsc && pnpm test run --coverage --passWithNoTests | ||
| ``` | ||
|
|
||
| Make hooks executable: | ||
| ```bash | ||
| chmod +x .git/hooks/pre-commit | ||
| chmod +x .git/hooks/pre-push | ||
| ``` | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### "Command not found: pnpm" | ||
|
|
||
| Install pnpm globally: | ||
| ```bash | ||
| npm install -g pnpm | ||
| ``` | ||
|
|
||
| Or use corepack (Node 16.9+): | ||
| ```bash | ||
| corepack enable | ||
| ``` | ||
|
|
||
| ### Cache Issues | ||
|
|
||
| If experiencing strange errors, clear caches: | ||
|
|
||
| ```bash | ||
| # Clear pnpm cache | ||
| pnpm store prune | ||
|
|
||
| # Clear Next.js cache | ||
| rm -rf .next | ||
|
|
||
| # Clear test cache | ||
| rm -rf .vitest | ||
|
|
||
| # Reinstall dependencies | ||
| rm -rf node_modules | ||
| pnpm install | ||
| ``` | ||
|
|
||
| ### CI Passes but Local Fails (or vice versa) | ||
|
|
||
| Ensure you're on the same Node version as CI: | ||
|
|
||
| ```bash | ||
| # Check your Node version | ||
| node --version | ||
|
|
||
| # CI uses "lts/*" - update if needed | ||
| nvm use --lts | ||
| ``` | ||
|
|
||
| ## Best Practices | ||
|
|
||
| 1. **Run checks frequently** - Don't wait until you're ready to push | ||
| 2. **Fix issues immediately** - Don't let them accumulate | ||
| 3. **Use watch mode during development** - Catch issues in real-time | ||
| 4. **Keep dependencies updated** - Outdated deps can cause check failures | ||
| 5. **Review CI logs** - When CI fails, read the full error message | ||
|
|
||
| ## Related Documentation | ||
|
|
||
| - [Contributing Guidelines](../../CONTRIBUTING.md) | ||
| - [PR Review Process](.claude/docs/PR_REVIEW_PROCESS.md) | ||
| - [Git Workflow](.claude/docs/GIT_WORKFLOW.md) | ||
|
|
||
| ## Summary | ||
|
|
||
| **Before every push:** | ||
| ```bash | ||
| pnpm lint && pnpm tsc && pnpm test run --coverage --passWithNoTests | ||
| ``` | ||
|
|
||
| **Keep these commands in sync with `.github/workflows/test.yml`** | ||
|
|
||
| This ensures your PR will pass CI checks and saves time in the review process! ✅ |
Oops, something went wrong.
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.
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.
Add a language specifier to the fenced code block.
The PR body template block has no language tag, causing the MD040 markdownlint warning. Use
markdownortextto suppress it:📝 Proposed fix
🧰 Tools
🪛 markdownlint-cli2 (0.21.0)
[warning] 25-25: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents