- Adds a model validation in addition to the existing database error, when users try to make a cycle (mark a node as its own parent or ancestor)
- Moves
PathField.get_roots()
toTreeQuerySetMixin.filter_roots()
. - Fixes a
TypeError
when usingTreeQuerySetMixin.get_descendants()
on an empty queryset.
Fixes another PostgreSQL 12 compatibility issue.
Fixes an SQL syntax error.
Fixes a PostgreSQL implicit type casting that was not done in PostgreSQL 12.
Fixes a source of path clashes when the objects have exactly the same values
for all order_by
columns.
Big rewrite using arrays of decimals instead of strings to represent the path.
For more details, see the benchmark results.
- Inserting becomes orders of magnitude faster, often faster than django-treebeard and django-mptt.
- Updating becomes faster in all cases, especially when the instance stays at the same place where it becomes orders of magnitude faster.
- Deleting becomes most of the time orders of magnitude faster.
- Reading stays as fast as it was.
- Add a new empty migration in each application that contains ``PathField``s.
- For each
PathField
defined in the application, add: -DeleteTreeTrigger
-RemoveField
of the path field -AddField
of the path field -CreateTreeTrigger
-RebuildPaths
For example:
DeleteTreeTrigger('Place'),
migrations.RemoveField('Place', 'path'),
migrations.AddField(
model_name='Place',
name='path',
field=PathField(db_index=True, order_by=['name'], size=None),
),
CreateTreeTrigger('place'),
RebuildPaths('place'),
You can also comment the PathField
in the model itself, run makemigrations
to create a first migration with the RemoveField
, add the DeleteTreeTrigger
before,
then uncomment the field in the model, run makemigrations
to generate a second migration with the AddField
in it, and finally add the CreateTreeTrigger
and RebuildPaths
at the end.