Tom Clegg wrote in #note-8:
19709-boot-db-migrate @ 41b9b83812826b77034fe13ea34047e194b1027f -- developer-run-tests: #3408 
I don't have any big concerns about this code as-is, I mostly have questions about why this approach was chosen.
What are the reason(s) we cannot or should not just call db:migrate
directly every time? It seems to handle the case of "no migrations need to be run" just fine. I see the comment about rake commands being "[relatively slow]" which, sure, I'll grant that, but is that the only reason?
If we can't run db:migrate
every time, Rails provides a db:migrate:status
task to report what migrations have and haven't been done. I understand this gets us back into slowness, but I feel like it's a pretty big upside to avoid reimplementing Rails' own logic for this, and potentially having subtle discrepancies. Are there other reasons besides slowness you decided against using this?
If we must do it ourselves, is it worth verifying that the migration version we pull out of the filename (d.Name()[:cut]
) is numeric before we add it to the todo list? Rails itself seems to require this, so our implementation could catch stray files lying in that directory that Rails itself ignores. It shouldn't be too bad if it happens, just a noop db:migrate
run, but if we're that concerned about avoiding those maybe it's worth it?
I think it would also be nice to see some of this "why this approach" discussion in the commit message, whatever we end up doing, in case future readers have questions.
Thanks.