Add support for migration hooks
The current migration system limits what one can do in a schema migration to things that are expressible in EdgeQL. In order to enable more elaborate data migrations we should add support for attaching a Python or a JavaScript (or any other supported language) function to a migration and run it in the same transaction as the migration. Both pre- and post- migration hooks make sense, so we should support both.
The "same transaction" requirement means that the hook function would receive a transaction object as its argument. We would need the server to expose pg_export_snapshot, SET TRANSACTION SNAPSHOT, as well as two-phase commit, so PREPARE TRANSACTION and COMMIT/ROLLBACK PREPARED. These could be useful on their own in advanced scenarios.
Probably done?