How do I override a method that's only invoked from a rake task

I want to override structure_dump in the MysqlAdapter class. (It
doesn't dump some stuff I need for my implementation and I'm extending
it to do that.)

I know how to override methods in application code.
MysqlAdapter#structure_dump is called from the rake task
db:structure:dump, and I can't figure out where to put the overriding
implementation so that it gets called when the rake task is invoked.
What's the secret?