supabase / cli

Supabase CLI. Manage postgres migrations, run Supabase locally, deploy edge functions. Postgres backups. Generating types from your database schema.
https://supabase.com/docs/reference/cli/about
MIT License
1.07k stars 209 forks source link

`supabase migration fetch`: failed to scan targets #2725

Closed tvogel closed 1 month ago

tvogel commented 1 month ago

Description When running supabase migration fetch, I receive

> npx supabase --create-ticket migration fetch 
Do you want to overwrite existing files in supabase/migrations directory? [Y/n] 
Connecting to remote database...
failed to scan targets: can't scan into dest[2]: cannot scan null into *string
Try rerunning the command with --debug to troubleshoot the error.
Sent crash report: a27a49210b894a6bbd9753984d8bf8c6

To Reproduce I am actually not sure - might depend on the specific project.

Expected behavior The migration data should be downloaded from the linked project.

System information Rerun the failing command with --create-ticket flag.

sweatybridge commented 1 month ago

Thanks for reporting this bug. It's actually caused by a null value in your migration history table. I will push a fix to handle this client side. Meanwhile, you can also repair the history table by reverting the bad entry

supabase migration repair 20230501231133 --status reverted
tvogel commented 1 month ago

Thank you for the explanation and the fix! 🪡