I need to relate groups of records, like I have 100 records in table, 3 of them should be known they are related, and other 5 are related to own group.
I don't need any group IDs or anything like that, I just need easy way to all records bound to given one.
Additionally, only very small part of records will need this, so I tried avoiding additional fields in table, but failed so far.
My best guess would be storing group id in the main table and somehow keeping track of highest group id used to not break anything (getting max value would work probably?)
It seems messy and somehow like too much overhead to me, I'd appreciate any suggestions
EDIT: my main table contains autoincremented unique id for each record, and rest of table might be considered blob, it is using innodb
for now I need to bind records created as batch, but I'm afraid it might be needed to bind already existing records (and I don't really want to mess too much with code maintaining the database, so I though of first creating all records, gathering their ids and then binding them)
EDIT2: I'm using ORM to manage DB records (Eloquent to be precise), so my question was purely about DB structure and I may even decide to use secondary table to store bulk ids and then create new bulk entity and then create new records with bulk id set for them