Dangerous misconception of "supabase migration"-CLI as it switches from local to remote
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:
supabase migration upsupabase 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
I ran into exactly this and it's pure luck it didn't break anything. Why is this by-default local environment tooling doing anything remotely without explicitly being told to do so? That's so far off from the expected behavior that it feels like at best a cruel prank.
Bump. Same here.