How does Bench Migrate work?

how does bench migrate work ? how do the tables in mariadb get updated? which part of frappe code is doing that?