git のブランチ間でのスキーマの差分を ALTER 文とかで出す

git difftool -x=schemalex branch1...branch2 path/to/schema

とやると出来る。

別に schemalex ではなくてもよく command <before> <after> で diff を求められるツールがあれば良い。*1

ちなみに git diff でやる場合には gitconfig に

diff ["sqldiff"]
        command = ...

gitattribuets に

*.sql diff=sqldiff

のように書く必用があるが *2 command には <path> <tmp_path1> <hex1> <mode1> <tmp_path2> <hex2> <tmp_path2> と渡るので *3 git difftool のほうが使いやすそうな感じがする。