Skip to content

Dangerous misconception of "supabase migration"-CLI as it switches from local to remote #3493

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
itinance opened this issue Apr 27, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@itinance
Copy link

itinance commented Apr 27, 2025

Bug report

  • [X ] I confirm this is a bug with Supabase, not with my own application.
  • [ X] I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

Serious issue! I ran migrations locally. While renaming some migration files to change the order of execution, the migration tool (which acted locally all the time), suddenly told me:

❯ npx supabase migration up
Connecting to local database...

Make sure your local git repo is up-to-date. If the error persists, try repairing the migration history table:
supabase migration repair --status reverted 20250426131800

So I did. And suddenly it reverted a migration ON REMOTE!

supabase migration repair --status reverted 20250426131800
Connecting to remote database...
Repaired migration history: [20250426131800] => reverted
Finished supabase migration repair.
Run supabase migration list to show the updated migration history.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. supabase migration up
  2. supabase migration repair ...

It is absolutely not clear why it suddenly executed on remote. This intransparency can destroy a remote environment.

Expected behavior

Getting execute locally as all other operations also happened locally.

Additional context

We either require a CLI argument like "--locally" or --env=local vs --env=remote in order to mitigate such issue.
Another idea would be that the CLI tool should always ask before it switches silently from local execution to remote.

With the current approach, it is really dangerous for any production environment!

System Information

Supabase: 2.22.6
Node.js: 20.18.3
V8: 13.2.152.41-electron.0
OS: Darwin arm64 23.6.0

@itinance itinance added the bug Something isn't working label Apr 27, 2025
@charislam charislam transferred this issue from supabase/supabase Apr 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant