laravel-nestedset icon indicating copy to clipboard operation
laravel-nestedset copied to clipboard

Added support, tests, sample-data for uuid

Open scottlaurent opened this issue 4 years ago • 1 comments

The main issues were minor after finally digging in on this.

  1. The parent id needed to be a string to allow for UUID
  2. the 'incrementing' needs to be an explicit 0 vs false because the tests failed when doing a class/array-diff check when self inspecting to see if the model was the same as the trait.
  3. SQLite was failing when using truncate, so I just used a delete() from the model to clear the DB on test teardown.

I thought about removing the (int) id's instead of duplicating the test suite, but it felt better knowing that it works in both cases entirely.

scottlaurent avatar Dec 12 '20 00:12 scottlaurent

UUID keys must an optional feature, so you can't change default schema for everyone

lazychaser avatar Feb 11 '22 06:02 lazychaser

I happened to run across this. There is a fine line here between the flexibility of allowing it to be used in a uuid scenario and forcing the int id's. The solution here was to convert to string which allows for the id and/or uuid to work, though in theory the lack of int type when actually using int can make it slow.

In any event, the uuid was an issue for us at the time. this is probably water under the bridge at this point.

scottlaurent avatar Dec 28 '22 18:12 scottlaurent