SQLite: Implement migrations SQL generator

(I'm looking for feedback on a few of the TODOs.)
A TODO may be necessary here to remember to cover those cases.