I'm new to GORM and I'm getting into it by fiddling with it, so what I'm doing might not be a great idea. Understood. ;-)
So, I have a callback method registered for after create, it's keeping track of what table and id is being inserted, then there is a function that rolls everything back with deletes. I'm using this for testing instead of resetting the database each time (please re-read my first sentence).
The problem is ... when GORM is using cascading, it's doing children first. It's inserting with an ID for a parent that it's not showing it has performed an insert for yet. Which is messing with the order I'm doing deletions since it's backward and the deletion violates foreign key constraints.
Any ideas on how to either detect a cascade and have a chance to reverse my queue entries, or get GORM to persist leaf nodes last?