Platform: Ruby on Rails with PostgreSQL database.
Problem: We are doing some backfilling to migrate our data to a new structure. It\'s created a rather convoluted sit