8000 fix: use len() for relation check in detectShowColumnsForER to support include filter by k1LoW · Pull Request #699 · k1LoW/tbls · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: use len() for relation check in detectShowColumnsForER to support include filter #699

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

Merged
merged 1 commit into from
May 18, 2025

Conversation

k1LoW
Copy link
Owner
@k1LoW k1LoW commented May 18, 2025

ref: #685

When using the include option in .tbls.yml to filter tables, the er.showColumnTypes.related/primary setting did not work as expected: columns other than PK and FK were not hidden in the ER diagram output. This is because the previous implementation checked only for nil on ChildRelations and ParentRelations, but after filtering, these fields become empty slices ([]) rather than nil.

By changing the check to use len(cc.ChildRelations) > 0 || len(cc.ParentRelations) > 0, the logic now correctly detects related columns even when the include filter is used. This ensures that only PK and FK columns are shown in the ER diagram as intended, regardless of the use of include.

@k1LoW k1LoW added the bug Something isn't working label May 18, 2025
Copy link
Contributor

Code Metrics Report

main (a730b8f) #699 (b7df563) +/-
Coverage 55.7% 54.1% -1.6%
Code to Test Ratio 1:0.4 1:0.4 0.0
Test Execution Time 4m40s 4m33s -7s
Details
  |                     | main (a730b8f) | #699 (b7df563) |  +/-  |
  |---------------------|----------------|----------------|-------|
- | Coverage            |          55.7% |          54.1% | -1.6% |
  |   Files             |             52 |             52 |     0 |
  |   Lines             |           4813 |           4813 |     0 |
- |   Covered           |           2683 |           2606 |   -77 |
  | Code to Test Ratio  |          1:0.4 |          1:0.4 |   0.0 |
  |   Code              |          10419 |          10419 |     0 |
  |   Test              |           4358 |           4358 |     0 |
+ | Test Execution Time |          4m40s |          4m33s |   -7s |

Code coverage of files in pull request scope (64.1% → 64.1%)

Files Coverage +/- Status
config/config.go 64.1% 0.0% modified

Reported by octocov

@k1LoW k1LoW changed the title Fix: use len() for relation check in detectShowColumnsForER to support include filter fix: use len() for relation check in detectShowColumnsForER to support include filter May 18, 2025
@k1LoW k1LoW merged commit ddeb88e into main May 18, 2025
4 checks passed
@k1LoW k1LoW deleted the fix/er-showcolumntypes-include branch May 18, 2025 06:23
@github-actions github-actions bot mentioned this pull request May 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
48C5 bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0