nylas / sync-engine

:incoming_envelope: IMAP/SMTP sync system with modern APIs
https://nylas.com/docs/platform
GNU Affero General Public License v3.0
3.5k stars 354 forks source link

Self-hosted sync engine parent folder reference #436

Open VinceWilkie opened 7 years ago

VinceWilkie commented 7 years ago

The Folder Table: The table itself has no parent references and I haven't found any other tables that reveal parent folder references. I've been trying to design a way to selectively traverse folders by using the name column.

Note: I am currently using version 5.4 of Laravel.

Let's say I have the following folder records: Folder 1 Folder 1/Folder 1.1 Folder 1/Folder 1.2 Folder 1/Folder 1.2/Folder 1.2.1

I've been able to use a combination of like and not like to capture a certain level of folders but it's proven difficult to get it using some kind of Laravel eloquent relationship.

Is there any way a parent folder relationship can added to the folder table? A "parent" column could be added to the folder table that would reference the folder tables id column? Or another (parent folder?) table could have two columns that reference the folder tables id column?

Ideally, I don't want to be selecting all folders to manage hierarchy because there could potentially be thousands of folders.

coastermcgee commented 7 years ago

A parent column would definitely be helpful in my opinion. Since the folders are being stored as a materialized path having a parent_id field would make it a snap to use in Laravel!