Answers.Body: <p><a href="https://docs.microsoft.com/en-us/archive/blogs/mvpawardprogram/hierarchies-convert-adjacency-list-to-nested-sets" rel="nofollow noreferrer">This</a> looks like a good high-level description of how to go about it.</p>
  <p>Also possibly useful: <a href="https://stackoverflow.com/questions/4664517/how-do-you-convert-a-parent-child-adjacency-table-to-a-nested-set-using-php-an">How do you convert a parent-child (adjacency) table to a nested set using PHP and MySQL?</a>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2014-06-22T08:18:37.367Z
Answers.LastActivityDate: 2021-01-19T20:45:17.450Z
Answers.LastEditDate: 2021-01-19T20:45:17.450Z
Answers.UserDisplayName: Marion Newlevant
Body: <p>Craft makes it nice and easy for us to have hierarchy in Structures or Categories. Many other popular CMS platforms support hierarchical data as well but some support it using a different data model.</p>
  
  <p>Here's an overview of managing hierarchical data in MySQL if anyone's interested:
  <a href="http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql" rel="nofollow">http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql</a></p>
  
  <p>In particular, I'm trying to understand the best way to migrate data that uses the Adjacency List Model into Craft which uses the Nested Set model.</p>
  
  <p>Are there any tools to help translate how each item in the table of the adjacency list model refers to a parent to how the nested set model uses lft and rgt to identify how the items in the table are nested?</p>
  
  <p>If there aren't any tools for this, is there any step-by-step process that might make this a bit more accessible?  Or could I just be thinking about it the wrong way?</p>
  
Tags: <categories><structure><migration><import><nested-set>
Title: How do you import hierarchical data that uses the adjacency list model into Craft Structures or Categories?
ThreadText: # How do you import hierarchical data that uses the adjacency list model into Craft Structures or Categories?
  
  (Asked by: username_0 on 2014-06-21)
  
  Craft makes it nice and easy for us to have hierarchy in Structures or Categories. Many other popular CMS platforms support hierarchical data as well but some support it using a different data model.
  
  Here's an overview of managing hierarchical data in MySQL if anyone's interested:
  <http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql>
  
  In particular, I'm trying to understand the best way to migrate data that uses the Adjacency List Model into Craft which uses the Nested Set model.
  
  Are there any tools to help translate how each item in the table of the adjacency list model refers to a parent to how the nested set model uses lft and rgt to identify how the items in the table are nested?
  
  If there aren't any tools for this, is there any step-by-step process that might make this a bit more accessible? Or could I just be thinking about it the wrong way?
  
  **Tags:** categories, structure, migration, import, nested-set
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-06-22. Score: 2
  
  [This](https://docs.microsoft.com/en-us/archive/blogs/mvpawardprogram/hierarchies-convert-adjacency-list-to-nested-sets) looks like a good high-level description of how to go about it.
  
  Also possibly useful: [How do you convert a parent-child (adjacency) table to a nested set using PHP and MySQL?](https://stackoverflow.com/questions/4664517/how-do-you-convert-a-parent-child-adjacency-table-to-a-nested-set-using-php-an).
  
  
  ---
  
  