Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@ enum Role {
}

enum ProjectType {
post
article
ebook
script
newsletter
}
Comment on lines 36 to 40
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.


model Project {
Expand Down
8 changes: 2 additions & 6 deletions src/components/models/projects/CreateProjectForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ export function CreateProjectForm() {
<FormSelect
control={form.control}
items={[
{
label: 'Post',
value: 'post'
},
{
label: 'Article',
value: 'article'
Expand All @@ -62,8 +58,8 @@ export function CreateProjectForm() {
value: 'ebook'
},
{
label: 'Script',
value: 'script'
label: 'Newsletter',
value: 'newsletter'
}
]}
name='type'
Expand Down