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
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.
What about running db diff?
The command is there.
Yeah.. I mean more how does it compare to doing a db dump?
The docs should state the difference, you can also test the two to see which gives you better result.
I did a supabase db pull and that seem to work great