| name | rename-entity |
| description | Use when adapting the template's placeholder Item entity to a hackathon problem statement's actual domain entity. |
Rename Entity Playbook
Follow these steps to rename the placeholder Item model to your target domain model (e.g., Ticket, Device, Asset):
-
Update Prisma Schema:
- Open
prisma/schema.prisma.
- Rename model
Item to NewModelName (e.g. Ticket).
- Update relation fields in
User, Request, and Review models pointing to Item (rename item to newModelName and type Item to NewModelName).
-
Run DB Migration:
- Run
npx prisma migrate dev --name rename_to_new_model.
- Run
npx prisma generate to rebuild client types.
-
Rename API Route Folders:
- Rename folder
src/app/api/items to src/app/api/new-model-plural (e.g., src/app/api/tickets).
- Inside the route handlers, replace Prisma client calls (e.g.,
prisma.item.create -> prisma.ticket.create).
-
Update Frontend Pages & Components:
- Rename
src/app/items/page.tsx and src/app/items/[id]/ to src/app/new-model-plural/page.tsx and src/app/new-model-plural/[id]/page.tsx.
- Rename
src/app/dashboard/items/ to src/app/dashboard/new-model-plural/.
- Update imports and fetch URLs inside these pages (replace
/api/items with /api/new-model-plural).
-
Update Seed Data:
- Update
prisma/seed.ts with domain-specific seed items matching your renamed schema.
- Run
npx prisma db seed to clear and repopulate the database.