Open wilson29thid opened 3 months ago
It looks like the paths are all up-to-date already, thanks to the callback we've had in place in the Unit
model. There are 3 root-level units, one of which has a NULL
path (Regt HQ), and 13 TPs that have NULL
ancestry for some reason.
select id, abbr, path, ancestry
FROM units
where path != concat('/', ancestry, '/')
or path is null or ancestry is null
id | abbr | path | ancestry |
---|---|---|---|
595 | Admins | / | |
624 | SLT | / | |
1631 | Regt. HQ | ||
1634 | 1522nd TP | /1631/361/362/486/43/ | |
1635 | 1523rd TP | /1631/361/362/486/43/ | |
1636 | 1524th TP | /1631/361/362/486/43/ | |
1645 | 1525th TP | /1631/361/362/486/43/ | |
1646 | 1526th TP | /1631/361/362/486/43/ | |
1647 | 1527th TP | /1631/361/362/486/43/ | |
1648 | 1528th TP | /1631/361/362/486/43/ | |
1649 | 1529th TP | /1631/361/362/486/43/ | |
1650 | 1530th TP | /1631/361/362/486/43/ | |
1651 | 1531st TP | /1631/361/362/486/43/ | |
1652 | 1532nd TP | /1631/361/362/486/43/ | |
1653 | 1533rd TP | /1631/361/362/486/43/ | |
1654 | 1534th TP | /1631/361/362/486/43/ |
So we can't use the column name "path" with the ancestry gem because ancestry already uses that term as a concept.
There's a new format for the
ancestry
column which is more performant. Also, there's guidance on indexing that we'll want to make sure we follow. This column is used a lot so should make a noticeable difference.https://github.com/stefankroes/ancestry
path
to/
and verify this doesn't break v2path
non-nullableutf8mb4_bin
) on column, and impact of changing it for existing valuesIf we want to use the
path
column:path
columnpath
ancestry
column and its indexOr if we want to continue calling it
ancestry
:ancestry
column and its indexpath
toancestry
ancestry
columnpath
toancestry
(there are a ton of these, and it looks like a real pain!)Finally:
path
whenancestry
is changedunit
factory to use new format