Command supabase db pull get's me a huge file with revokes

Hey guys, i have 2 remote instances one for dev and other for prod and I'm using cli to manage migrations between them. I got the first migration file linking to dev remote instance and running supabase db pull which worked fine. After that i did some updates and ran again supabase db pull but now got a use file with revokes instead of simple the delete table i did. Does anyone has faced this before?
4 Replies
Dev
Dev3w ago
I’ve seen this happen too. It usually comes from pulling changes after dropping tables.
Supabase includes permission changes in the migration. One workaround is to clean up the migration file manually or re-run db reset in dev and then generate the migration again. It might be worth checking if your roles/permissions are different between dev and prod.
Almopt
AlmoptOP3w ago
no they are the same in dev and prod. for now what I did was exactly what you said. I comment out the rest of the migration file and just let the delete operation. In the next db pull from my remote instance it will check correctly the schemas? other question: what the proper command to use in this use case, db pull or db diff? i've just created a RSL for a table and did supabase db pull again and got the huge file again with revokes and all the schema again.
Dev
Dev3w ago
If the schemas are identical, commenting out the extra statements and keeping only the intended operation is fine. On your next db pull, Supabase should reconcile the schema correctly. However, for schema changes between environments, the recommended approach is to use supabase db diff to generate migrations, since db pull is mainly for syncing your local schema with the remote. Um..., Using db diff will help you avoid the large migration files full of revokes and unnecessary re-definitions. 😉
Almopt
AlmoptOP3w ago
i've tried using db diff command and still got a large migration file

Did you find this page helpful?