I have created my tables from UI, how to generate ...
# help
a
I have created my tables from UI, how to generate the sql query used to generate the table so I can keep them saved in my git repo for when I want to recreated a similar project?
k
You can use any migration tool you like. Supabase has it's own one in the
supabase
CLI tool, I think this command (after init and login) should take a snapshot of your database: https://supabase.com/docs/reference/cli/supabase-db-commit
Or you can just use pg_dump, but that will only help you with initial schema and not with later changes
a
(venv) fastapi-supabase-svelte$ supabase db remote commit Error: Failed to connect to Docker daemon. Is Docker running?
Why is it looking for docker daemon. I am using the hosted version of supabase and developing on my pc locally, no docker involved.
k
I think it tries to start a local supabase development environment? But don't listen to me,
... remote commit
seems to be for applying migrations, not generating them >_>
(you need
... remote set URL
to work with your remote database)
a
I did
Copy code
python
supabase db remote set 'postgresql://postgres:xxxxxxxxxxxxxxxx@db.xxxxxxxxxxxx.supabase.co:5432/postgres'
supabase db remote commit
k
sorry, I've read the documentation wrong,
... remote commit
seems to be for applying migrations. You'll need pg_dump to make the initial migration, and then use a migration tool while developing your application.