Skip to content
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

bug fix Issue 138 #149

Merged
merged 5 commits into from
Nov 17, 2022
Merged

bug fix Issue 138 #149

merged 5 commits into from
Nov 17, 2022

Conversation

dznbk
Copy link
Contributor

@dznbk dznbk commented Nov 15, 2022

Sorry if it is hard to read as it is a tool translation.

summary

#138

This is a fix for a bug reported in issue 138.

If a model UserSetting containing a map existed after a model User not containing a map
User's id field was being overwritten by UserSetting's map name.

There were two issues.

  1. // skip lines before the current model
    was including subsequent models in the decision
  2. find matched any field containing "id" because it was a simple character search.

For issue 1, we fixed the problem so that only the current model is filtered.
For problem 2, we added ${field.name} -> ${field.name} and a space to make it match more strictly.

check

$ npm run test --t issues/138                                                                            

> prisma-erd-generator@1.2.3 test
> jest --passWithNoTests issues/138

 PASS  __tests__/issues/138.test.ts
  ✓ id not override before key name (2641 ms)

----------|---------|----------|---------|---------|-------------------
File      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
----------|---------|----------|---------|---------|-------------------
All files |       0 |        0 |       0 |       0 |                   
----------|---------|----------|---------|---------|-------------------
Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        2.978 s, estimated 3 s
Ran all test suites matching /issues\/138/i.

result svg

138

We would appreciate your review.

@keonik
Copy link
Owner

keonik commented Nov 17, 2022

@all-contributors please add @dznbk for code

@allcontributors
Copy link
Contributor

@keonik

I've put up a pull request to add @dznbk! 🎉

@keonik keonik merged commit d5208cf into keonik:main Nov 17, 2022
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.

None yet

2 participants