Skip to content
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

Supbase local migration not being updated in remote #2136

Closed
2 tasks
emmyduruc opened this issue Apr 9, 2024 · 14 comments
Closed
2 tasks

Supbase local migration not being updated in remote #2136

emmyduruc opened this issue Apr 9, 2024 · 14 comments
Labels
bug Something isn't working

Comments

@emmyduruc
Copy link

Bug report

i am using the CLI migration locally is up-to-date and i can see new tables in studioURL but when i run $ "supabase db push"
Connecting to remote database...
Remote database is up to date.
and when i check my remote db the changes are not up-to-date

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

Describe the bug

the Remote db is not getting updated
A clear and concise description of what the bug is.
i am using the CLI migration locally is up-to-date and i can see new tables in studioURL but when i run $ "supabase db push"
Connecting to remote database...
Remote database is up to date.

To Reproduce

supabase create new migration

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

  1. Go to '…'
  2. Click on '…'
  3. Scroll down to '…'
  4. See error

Expected behavior

That the local changes should be in the remote when i run supabase db push
A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem.

System information

  • OS: [e.g. macOS, Windows]
  • Browser (if applies) [e.g. chrome, safari]
  • Version of supabase-js: [e.g. 6.0.2]
  • Version of Node.js: [e.g. 10.10.0]

Additional context

Add any other context about the problem here.

@emmyduruc emmyduruc added the bug Something isn't working label Apr 9, 2024
@saltcod
Copy link
Contributor

saltcod commented Apr 9, 2024

Thanks @emmyduruc — do any of the other local commands work? (ie: are you certain the project is linked correctly?)

@emmyduruc
Copy link
Author

Thanks @emmyduruc — do any of the other local commands work? (ie: are you certain the project is linked correctly?)

the project is linked correctly all other local commands works effectively

@saltcod saltcod transferred this issue from supabase/supabase Apr 10, 2024
@sweatybridge
Copy link
Contributor

Could you run supabase migration list and share the output?

@emmyduruc
Copy link
Author

Could you run supabase migration list and share the output?
here is the output from "supabase migration list"
image

@sweatybridge
Copy link
Contributor

sweatybridge commented Apr 11, 2024

It does seem like all your local migrations are already pushed to remote.

Can you elaborate which migration file and which statement is missing on remote?

@emmyduruc
Copy link
Author

They are pushed to remote but i do not see the new tables the local and remote tables looks totally different though the migrations are in sync

@sweatybridge
Copy link
Contributor

sweatybridge commented Apr 11, 2024

Can you run supabase projects list to check that you are linked to the right project?

If so, run supabase db pull. This will pull down schema changes from remote to local so they are back in sync.

@emmyduruc
Copy link
Author

Can you run supabase projects list to check that you are linked to the right project?

If so, run supabase db pull. This will pull down schema changes from remote to local so they are back in sync.

@sweatybridge thanks for your comment.... i have checked the project list it seems i am connected to the right project i also pulled the remote yet they remain unsynced

Local Remote
Screenshot 2024-04-11 at 13 42 40 Screenshot 2024-04-11 at 13 35 52

I literally have no clue on how to resolve this as it seems super frustrating

@sweatybridge
Copy link
Contributor

One more question to check: have you saved all your local migrations to disk? This can be done with supabase db diff which should report no changes found.

@emmyduruc
Copy link
Author

One more question to check: have you saved all your local migrations to disk? This can be done with supabase db diff which should report no changes found.

Unfortunately did not help

@sweatybridge
Copy link
Contributor

sweatybridge commented Apr 11, 2024

Unfortunately did not help

What's the output from supabase db diff and supabase db diff --linked?

@sweatybridge
Copy link
Contributor

sweatybridge commented Apr 11, 2024

As a last resort, you can also reset your remote database: supabase db reset --linked

This will delete all data in your remote database so make sure to have a backup.

@sweatybridge
Copy link
Contributor

sweatybridge commented Apr 15, 2024

Any updates on this one? There's another way to sync up your schema

  1. Start a local database
supabase db start
  1. Backup your migrations directory
mv supabase/migrations supabase/backup
  1. Dump your remote schema
mkdir supabase/migrations
supabase db dump -f supabase/migrations/0_schema.sql
  1. Save local diff as a migration file
supabase db diff -f schema_drift
  1. Repair your migration history and push
supabase migration repair --status reverted
supabase migration repair --status applied 0
supabase db push

I think these steps will be simpler with declarative schema. But for now, you will have to fix the schema drift using those steps above.

@ericdjavid
Copy link

Thanks for that @sweatybridge, helped me a lot! 👍

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

4 participants