Hi all,
I’m new to building on Lucee and Coldbox. Just getting up to speed now and I’ve been told this is the place to be!
I’m working on a project at the moment that has existing tables and data. Essentially a Profile table, Directory table, and a table (let’s call ProfileDirectory) that links the two in a many-to-many type of relationship all handled by the ORM in Coldbox. All well and good so far.
Now… I want to extend the functionality so that Profiles listed in a Directory can be a ‘basic’ or ‘premium’ listing. I know how to tackle this from a direct SQL query approach, but the ORM is fairly ingrained in the current project so I need to work with that. My line of thinking is to extend the ProfileDirectory table from 2 columns (which have the IDs of each of the other tables) to include a third column that’ll indicate ‘basic’ or ‘premium’ (this could be a simple INT or Boolean).
Right… My understanding from googling the interwebs, doing this to a many-to-many ORM relationship tends to lead to creating a third data model (for ProfileDirectory), then having a many-to-one and one-to-many between all three,
eg. Profile => m2o => ProfileDirectory => o2m => Directory.
Rather than the existing: Profile => m2m (ProfileDirectory) => Directory.
So… I’m a little unclear on the best approach without direct intervention into the database to modify the existing data, as I see ProfileDirectory table becoming something like: (id, premium, profileID, directoryID).
Perhaps I’m going about this the entirely wrong way??? Any help to implement the above or should I approach it differently?
Thanks in advance and I look forward to connecting further with the community.