Switch to maintained migra package
What kind of change does this PR introduce?
The package migra has been unmaintained for 3 years, and there are several issues that have been unresolved, especially due to new functions available in later postgres versions
This PR is meant to use a more recently maintained fork of migra so that supabase can have better support for schema diffing
What is the current behavior?
Current users can choose between choose between migra or pg-schema-diff or pgadmin but it seems like the old version of migra is still the default because it covers most of the cases needed for supabase users
Please link any relevant issues here.
What is the new behavior?
Right now I've forked the old migra to: https://github.com/PhilipWee/migra
And it's dependency schemainspect to:
https://github.com/PhilipWee/schemainspect
Currently done: [x] Forked [x] Fixed broken test cases for pg16, pg17 [x] Automatic docker image publishing [x] Automatic pypi publishing
WIP before merging this PR makes sense: [] Backward compatibility test cases for pg10 - pg 15 [] Update migra documentation [] Fixed deprecated function call warnings [] Fix https://github.com/djrobstep/migra/issues/243
- When migra looks for dependencies, it doesn't consider functions are dependent on enum types
- So when the enum type changes, it doesnt recreate the function
- Need to edit upstream
schemainspectto catch metadata regarding function dependencies before recreating the func inmigra
Additional context
Just wanted to open this PR even though its not ready for merging just to get some feedback along the way
Some questions:
- Should I update the build script in the cli to build a
supabase/migrabased off https://github.com/PhilipWee/migra or is using the autodeployed one from my repo fine? - Are there any particularly common issues raised with
db diffthat should be targeted first
Pull Request Test Coverage Report for Build 15269737294
Details
- 0 of 0 changed or added relevant lines in 0 files are covered.
- 7 unchanged lines in 2 files lost coverage.
- Overall coverage decreased (-0.01%) to 60.208%
| Files with Coverage Reduction | New Missed Lines | % |
|---|---|---|
| internal/utils/container_output.go | 2 | 60.96% |
| internal/gen/keys/keys.go | 5 | 12.9% |
| <!-- | Total: | 7 |
| Totals | |
|---|---|
| Change from base Build 15267953689: | -0.01% |
| Covered Lines: | 9027 |
| Relevant Lines: | 14993 |
💛 - Coveralls
Okay I have fixed a grand total of one bug in the new migra package, namely https://github.com/djrobstep/migra/issues/243
So the new updated version of migra is very marginally better, so now it now makes sense to merge at least this version while I continue making improvements
However, I have the following concerns
- The docker registry points to
ecr aws supabaseby default for faster pull times, which means that a seperate build script is needed to ensure that the mirror registry is initialised properly, which is not so easy for me to test on my side - When I try to run it locally with the
docker.ioregistry, it fails regardless, even for the existingsupbase/migracontainer. I suspect its because I'm running windows, but I'm not sure what magic runs to makenpx supabasework in this scenario
If I can get some guidance on the above that would be great, but in the meantime I'll continue improving the migra package to tackle the limitations listed in the supabase docs