SQLite: Implement migrations SQL generator

(I'm looking for feedback on a few of the TODOs.)
Also, it doesn't seem to be generally used by the migrations pipeline.