Supabase migration confusion

Hi I'm having a bit of confusion with the Migrations. Is the suggested way to make changes to a Supabase table via SQL or the UI or both? If both how do I ensure my local development is always up to date with my production with multiple developers? I feel the migration documentation is very surface level and doesn't really go into real production/development use cases unless I've missed something?
8 Replies
ihm40
ihm402mo ago
i think the recommended way to do it is via the cli using migration files if you want a more "formal process"
patito1009
patito10092mo ago
I'm with you, migration documentation is very incomplete as you say. The managing environments guide only shows how to manage environments if starting to build locally (local first -> push once done) which I get it is the recommended way to build. But if you try set up migrations the other way around (start remote -> pull to local) it's really a pain. I think they should cover all those scenarios since probably the learning curve of supabase starts on the web, not locally.
ihm40
ihm402mo ago
Yeah i think that is fair feedback though i just took a look and "managing environments" comes under deployments in the documentation which probably assumes the cli as a pre-cursor.
patito1009
patito10092mo ago
But even if if they assume cli as a pre-cursor, they should cover how to correctly migrate from developing on the web to local. I've been trying myself for the past few weeks to migrate a project that I started on the web and want to start developing locally so I can later set another project for production, and I still can't figure it out at 100% because of the poor information given for a lot of things. Migrations are really a MESS, in one of my latest attempts to pull changes to the storage schema the command supabase db pull decided to write a ton of revoke statements that removed absolutely all permissions from the storage schema to all database users, leaving storage completely unusable. If just pulling a schema creates all this problems, how am I supposed to feel safe that an automated workflow won't generate breaking statements that will impact on a production database? https://discord.com/channels/839993398554656828/1412156678459359243
patito1009
patito10092mo ago
GitHub
Privileges revoked from all storage tables after pull of storage sc...
Describe the bug When using supabase db pull --schema storage the migration file contains lots of revoke statements that remove all privileges of all storage stables from all database users (anon, ...
ihm40
ihm402mo ago
this is a good place to add the issue
cerwind
cerwindOP2mo ago
Thanks! I'm just very surprised there's not more information on this something like database schema control and the recommended processes should be crystal clear because once you start in one direction it's very hard to go back.

Did you find this page helpful?