-
Couldn't load subscription status.
- Fork 0
feat: Update ProjectType enum in Prisma schema #31
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
Conversation
WalkthroughProjectType enum in Prisma schema updated: removed post and script, added newsletter. The create project form’s type select options were synchronized to reflect these enum changes. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
prisma/schema.prisma(1 hunks)src/components/models/projects/CreateProjectForm.tsx(1 hunks)
🔇 Additional comments (1)
src/components/models/projects/CreateProjectForm.tsx (1)
61-62: Form options correctly synchronized with schema changes.The form select options now correctly reflect the updated
ProjectTypeenum values. The default value'article'remains valid and is preserved.
| enum ProjectType { | ||
| post | ||
| article | ||
| ebook | ||
| script | ||
| newsletter | ||
| } |
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.
🧩 Analysis chain
Verify data migration strategy before removing enum values.
Removing post and script from the ProjectType enum is a breaking schema change. If any Project records exist in the database with type='post' or type='script', the migration will fail or cause runtime errors.
Recommended approach:
- First migration: Backfill existing data (update
post→newsletter,script→article, or as appropriate) - Second migration: Remove the enum values
Run the following script to check for existing projects with the removed enum values and verify the migration file:
🏁 Script executed:
#!/bin/bash
# Description: Check for code references to removed ProjectType values and verify migration
# Search for string literal references to 'post' and 'script' as ProjectType values
echo "=== Searching for 'post' ProjectType references ==="
rg -nP --type=ts --type=tsx --type=js --type=jsx -C3 "type:\s*['\"]post['\"]|ProjectType\.(post|POST)|['\"]post['\"].*as\s+ProjectType"
echo -e "\n=== Searching for 'script' ProjectType references ==="
rg -nP --type=ts --type=tsx --type=js --type=jsx -C3 "type:\s*['\"]script['\"]|ProjectType\.(script|SCRIPT)|['\"]script['\"].*as\s+ProjectType"
echo -e "\n=== Checking for migration files ==="
fd -e sql -e js -e ts . prisma/migrations/
echo -e "\n=== Searching for ProjectType enum usage patterns ==="
rg -nP --type=ts --type=tsx -C2 "ProjectType\s*=|enum\s+ProjectType|type\s+ProjectType"Length of output: 463
Add two-phase Prisma migration for enum removal.
- Backfill existing records: update
post→newsletterandscript→article. - Create a new migration to remove
postandscriptfrom theProjectTypeenum. - Audit and update any code references to these deprecated values.
This PR updates the
ProjectTypeenum inprisma/schema.prisma.Motivation:
Changes Made:
prisma/schema.prismato reflect the updatedProjectTypeenum.ProjectTypewill need to be updated to 'newsletter' or other valid types.Review Notes:
prisma/schema.prisma.ProjectTypeare updated to handle the new enum values.Summary by CodeRabbit
New Features
Chores