Skip to content

Switch to maintained migra package #3620

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

PhilipWee
Copy link
Contributor

@PhilipWee PhilipWee commented May 27, 2025

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 djrobstep/migra#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 schemainspect to catch metadata regarding function dependencies before recreating the func in migra

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:

  1. Should I update the build script in the cli to build a supabase/migra based off https://github.com/PhilipWee/migra or is using the autodeployed one from my repo fine?
  2. Are there any particularly common issues raised with db diff that should be targeted first

@PhilipWee PhilipWee requested a review from a team as a code owner May 27, 2025 07:56
@coveralls
Copy link

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%
Totals Coverage Status
Change from base Build 15267953689: -0.01%
Covered Lines: 9027
Relevant Lines: 14993

💛 - Coveralls

@PhilipWee PhilipWee changed the title Update Dockerfile Switch to maintained migra package May 30, 2025
@PhilipWee
Copy link
Contributor Author

Okay I have fixed a grand total of one bug in the new migra package, namely djrobstep/migra#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

  1. The docker registry points to ecr aws supabase by 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
  2. When I try to run it locally with the docker.io registry, it fails regardless, even for the existing supbase/migra container. I suspect its because I'm running windows, but I'm not sure what magic runs to make npx supabase work 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding value to enum type causes "cannot drop type" when a function is using that type for a parameter
2 participants