[Dbix-class] Representing directory structures

Bill Moseley moseley at hank.org
Sun Apr 7 18:42:01 GMT 2013


Anyone using DBIC to represent hierarchal directory (folder) structures?

Essentially just like a file system, except users each have their own root.
 To add to the complexity, I need to be able to "share" folders and all
child elements to other users.

My assumption is this would involve a single table where each row can
represent either a directory entry (e.g. a "file") or a sub-directory that
references its parent.

Postgresql has "WITH RECURSIVE" which DBIC has no support for (other than
virtual views):

http://www.postgresql.org/docs/9.2/static/queries-with.html


But, Adjacency Lists and Nested Sets are (were?) often discussed as
solutions for hierarchal data in the database.  I asked on the Pg list back
in 2007:

http://postgresql.1045698.n5.nabble.com/Adjacency-List-or-Nested-Sets-to-mo=
del-file-system-hierarchy-td1876116.html


but, so far, I've happily avoided using these approaches of representing
hierarchal data in the database.


BTW -- I have recently written a "tag"-based system (like the familiar
gmail) which is easy to represent in a highly normalized schema but is a
fundamentally different approach.


-- =

Bill Moseley
moseley at hank.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20130407/0ac=
006b5/attachment.htm


More information about the DBIx-Class mailing list