|
|
|
|
|
by daniel-ash
1049 days ago
|
|
Thanks, appreciate this. A few comments: I like being able to call supabase db dump (data only) and not touch code in the file at all - I get that adding SET session_replication_role = replica; is one line, but still my preference is to avoid. But like I said I already disable triggers ahead of the seed script running. I currently use supabase db reset quite frequently as I make changes in development. Using supabase migration up would mean moving the latest migration out of the migrations folder, running supabase db reset, moving the file back in and then calling supabase migration up. Which is not the worst idea, I'd still be looking to automate those steps with my own script atm tho. Re: squash I have been a little cautious to use it since I first noticed it in the CLI docs as I wasn't really sure what the actual outcome would look like
If I have something like this in a migration script: --set initial permissions
INSERT INTO rbac.permissions(name)
SELECT unnest(enum_range(NULL::rbac.permission_name))
except
SELECT name
FROM rbac.permissions; what would squash do to handle this data? |
|
> Using supabase migration up would mean moving the latest migration out of the migrations folder, running supabase db reset, moving the file back in and then calling supabase migration up.
We can definitely do a better job here. I'm adding support for db reset --version flag [0]. This should allow you run migration up without moving files around directories.
> I wasn't really sure what the actual outcome would look like If I have something like this in a migration script
Agree that we can do a better job with the documentation for squash command. I will add more examples.
The current implementation does a schema only dump from the local database, created by running local migration files. Any insert statements will be excluded from the dump. I believe this is not the correct behaviour so I've filed a bug [1] to fix in the next stable release.
[0] https://github.com/supabase/cli/pull/1369
[1] https://github.com/supabase/cli/issues/1370