edgedb-cli icon indicating copy to clipboard operation
edgedb-cli copied to clipboard

Add support for migration hooks

Open elprans opened this issue 2 years ago • 1 comments

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.

elprans avatar Nov 15 '23 18:11 elprans

Probably done?

MartinCura avatar Apr 24 '25 15:04 MartinCura