SQLite: Implement migrations SQL generator

(I'm looking for feedback on a few of the TODOs.)
Ah, ok, missed "ON". Then it makes sense to move.