Draft implementation of run:optimize, using migrations to add indices