Add support for migration hooks
- Dominant language
- Rust
- Stars
- 175
- Forks
- 32
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading the migration system and its transaction handling; no specific files or tests are named in the issue. Clarify the design for attaching Python or JavaScript functions as pre- and post-migration hooks, then define how the transaction object, exported snapshots, and two-phase commit make same-transaction execution verifiable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, python
- Domain
- backend-api-design, databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100