fix(prisma): resolve schema validation errors blocking setup#5
Open
TUAN130294 wants to merge 1 commit into
Open
fix(prisma): resolve schema validation errors blocking setup#5TUAN130294 wants to merge 1 commit into
TUAN130294 wants to merge 1 commit into
Conversation
…, nclamvn#3) - HRM-unified: rename duplicate ImportStatus enum to ImportSessionStatus - HRM-unified: add missing reverse relations on Tenant, User, Employee - HRM: add missing url field in datasource block - .env.example: fix DATABASE_URL to match docker-compose.yml credentials - All 12 Prisma schemas now pass validation
|
Sau khi fix được lỗi này, run dev thì port nào mở lên cũng lỗi 404. bạn có đang gặp tình huống này không? |
|
nó bị 1 lỗi chung là có 2 file app (app/api và src/app )trong source, ai biết xử lý không |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes #1, #3 — All
npm run setup/make setupcommands fail atdb:generatestep due to Prisma schema validation errors.Root Causes & Fixes
1. Duplicate enum
ImportStatus(HRM-unified)Two enums with the same name but different values exist in
apps/HRM-unified/prisma/schema.prisma:ImportStatuswithPENDING, PROCESSING, COMPLETED, FAILED, ROLLED_BACK(used byImportJob)ImportStatuswithDRY_RUN, PREVIEWING, EXECUTING, COMPLETED, FAILED, ROLLED_BACK(used byImportSession)Fix: Renamed the second enum to
ImportSessionStatussince it serves a distinct purpose (data import session lifecycle vs. generic import job status). Updated theImportSession.statusfield type accordingly.2. Missing reverse relations (HRM-unified)
Models
KPIPeriod,KPIScore,DisciplinaryRecord,SalaryAdvance,ImportSession, andSystemSettingreferenceTenant,User, andEmployeebut the reverse relation arrays were never added to those parent models.Fix: Added the missing reverse relation fields to
Tenant,User, andEmployeemodels.3. Missing datasource URL (HRM)
apps/HRM/prisma/schema.prismadatasource block had nourlfield.Fix: Added
url = env("DATABASE_URL").4. DATABASE_URL mismatch (.env.example)
.env.examplehadpostgresql://vierp:your-password@localhost:5432/vierp_devbutdocker-compose.ymlcreates DB with usererp, passworderp_dev_2026, databaseerp_dev.Fix: Updated
.env.exampletopostgresql://erp:erp_dev_2026@localhost:5432/erp_dev.Verification
Tested
npx prisma@5.22.0 validateon all 12 schema files:Files Changed
apps/HRM-unified/prisma/schema.prisma— enum rename + reverse relationsapps/HRM/prisma/schema.prisma— datasource URL.env.example— DATABASE_URL credentials