https://supabase.com/ logo
#sql
Title
# sql
j

Jørgen

12/30/2021, 7:41 PM
So, I want to have a local copy of all my plpgsql functions, in case they get lost or if I want to re-create the DB locally. Right now I am copying them manually over to supabase, but is there an API to push them to supabase, so I can automate this? Thanks!
s

silentworks

12/30/2021, 7:43 PM
You can use any database migration library to do this
j

Jørgen

12/30/2021, 7:44 PM
Ahh, right because it can connect directly to the postgres instance.. okay, thanks!
s

silentworks

12/30/2021, 8:35 PM
Just make sure the credentials aren't available to the frontend app. I'm doing my deployments with GitHub actions on fly.io and I store my database credentials inside of GitHub secrets
o

oskar

12/30/2021, 9:08 PM
@User do you have them in an .sql file and push it with psql then?
s

silentworks

12/30/2021, 9:10 PM
Take a look at my waiting list project, the migrations directory. https://github.com/silentworks/waiting-list
Ley handles the running of the migrations for me https://github.com/lukeed/ley
o

oskar

12/30/2021, 10:10 PM
that looks pretty sweet, simple. thank you