Reminders to myself or whoever else ever looks in here... SQLite needs some heavy refactoring, the subroutines are becoming too complex to understand easily. Relationship-building needs to be refactored into a seperate module to share with SQLT. Relationship stuff: Fix multiple rels between same pair of tables If local column is UNIQUE or PK, use has_one() for relation? Re-scan relations/tables after initial relation setup to find ->many_to_many() relations to be set up? Check NULLability of columns involved in the relationship, which might suggest a more optimal non-default -join-type? While scanning for many-to-many, scan for implied rels as well? (if foo->belongs_to('bar') and baz->belongs_to('bar'), does that impliy foo->might_have('baz') and the reverse?) ...