-
Notifications
You must be signed in to change notification settings - Fork 58
Add UUID support for parent_id columns in filament-tree #84
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
base: 3.x
Are you sure you want to change the base?
Conversation
@lam0819 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs. I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review. |
Co-authored-by: lam0819 <[email protected]>
@copilot review first before i review |
Co-authored-by: lam0819 <[email protected]>
I've completed my review of the UUID support implementation and identified several logic issues that I've now fixed: Issues Found & Fixed:
The implementation now properly handles both integer and UUID parent keys with correct SQL generation and type-safe comparisons. All backward compatibility is maintained for existing integer-based trees. Commit: Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
This PR adds comprehensive UUID support for
parent_id
columns in filament-tree, addressing the limitation where the package only worked with integer parent IDs.Problem
Previously, the package assumed integer
parent_id
values with-1
as the default for root nodes. This prevented users from using UUIDs in their tree schemas, as the package would:treeColumns()
<= 0
) that don't work with UUIDs-1
as the default parent valuenull
parent values for UUID-based root nodesSolution
The implementation adds UUID support while maintaining full backward compatibility:
Migration Support
Extended the
treeColumns()
macro to accept a parent column type parameter:Configuration Flexibility
Users can now configure the default parent ID to work with UUIDs:
Smart Logic
Updated comparison and tree-building logic to handle both numeric and non-numeric parent keys:
-1
(integers) andnull
(UUIDs)isRoot()
andscopeIsRoot()
handle both cases with proper SQL generationExample Usage
Code Quality Improvements
During implementation review, several logic issues were identified and fixed:
WHERE parent_id IS NULL
vsWHERE parent_id = NULL
)All existing integer-based implementations continue to work without any changes required.
Fixes #83.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.