Skip to content

Conversation

@albertyosef
Copy link
Collaborator

@albertyosef albertyosef commented Oct 5, 2025

This PR updates the ProjectType enum in prisma/schema.prisma.

Motivation:

  • Remove 'post' and 'script' types as they are no longer needed.
  • Add 'newsletter' type to support new project requirements.

Changes Made:

  • Modified prisma/schema.prisma to reflect the updated ProjectType enum.
  • A new migration file will be generated to apply these schema changes to the database.
  • All occurrences of 'post' and 'script' in the codebase related to ProjectType will need to be updated to 'newsletter' or other valid types.

Review Notes:

  • Please review the schema changes in prisma/schema.prisma.
  • Verify that the generated migration correctly reflects the enum changes.
  • Ensure all code references to ProjectType are updated to handle the new enum values.

Summary by CodeRabbit

  • New Features

    • Added “Newsletter” as a selectable project type when creating a project.
  • Chores

    • Removed “Post” and “Script” project type options from the creation form and underlying allowed values.
    • Existing project types “Article” and “eBook” remain available.
    • Default project type remains “Article.”

@coderabbitai
Copy link

coderabbitai bot commented Oct 5, 2025

Walkthrough

ProjectType 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

Cohort / File(s) Summary
Schema
prisma/schema.prisma
Modified enum ProjectType: removed members post, script; added newsletter. Existing article, ebook unchanged.
Frontend form options
src/components/models/projects/CreateProjectForm.tsx
Updated FormSelect options to remove Post/Script and add Newsletter. Default remains article.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • fehranbit

Poem

Thump-thump, my paws approve this feat—
Post and Script hop off their seat.
Newsletter nibbles into view,
Article, Ebook—still the crew.
Schemas align, the fields are neat,
Form drops in sync—complete! 🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly describes the main change—updating the ProjectType enum in the Prisma schema—and follows conventional commit style, making it clear and specific.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/update-project-type-enum

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between b1e16b6 and e435eb7.

📒 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 ProjectType enum values. The default value 'article' remains valid and is preserved.

Comment on lines 36 to 40
enum ProjectType {
post
article
ebook
script
newsletter
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 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:

  1. First migration: Backfill existing data (update postnewsletter, scriptarticle, or as appropriate)
  2. 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 postnewsletter and scriptarticle.
  • Create a new migration to remove post and script from the ProjectType enum.
  • Audit and update any code references to these deprecated values.

@fehranbit fehranbit merged commit be51242 into main Oct 5, 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