S
Supabase8mo ago
Mike

Create initial Database migration file from already developed DB

Hi all, I'm new to Supabase and I'm really enjoying it so far. I have 2 Supabase projects that is reflecting Prod and Dev. Dev is the one I've been developing and Prod is newly created with a fresh database. I want to create an initial migration file that recreates the current state of the Dev database that I can apply to Prod. How can I do that? Can I use a command in the Supabase CLI to acomplish that? /Mike
6 Replies
silentworks
silentworks8mo ago
You can do a db dump with the CLI https://supabase.com/docs/reference/cli/supabase-db-dump. You can pipe this into a migration if you wish or just follow the command and send it to a schema.sql file.
Mike
MikeOP8mo ago
What about running db diff?
silentworks
silentworks8mo ago
The command is there.
Mike
MikeOP8mo ago
Yeah.. I mean more how does it compare to doing a db dump?
silentworks
silentworks8mo ago
The docs should state the difference, you can also test the two to see which gives you better result.
Mike
MikeOP8mo ago
I did a supabase db pull and that seem to work great

Did you find this page helpful?