Better model migration script

Currently we do a single non-paginated index query and then churn through the objects. If we have lots of objects (message store models, for example) this isn't good enough.