Automate SQL Migrations based on local seed script

Hey folks - looking to automate sql migrations from a local instance (using the CLI) to a production instance - managed by supabase.

I've been maintaining my seed.sql locally so it can stand up all relations/functions/triggers, and when I originally created my instance on app.supabase.com, I just copy/pasted that script into the in-browser sql editor.

I'm looking at setting up CI/CD now for the project, and wanted to script out any changes detected to the local seed.sql script to run them on the prod DB.

I'm wondering if the proper approach is to now treat my seed.sql as "read-only" now that I've run it to get started in my "prod instance", and now to create a migration.sql script whenever a feature requires sql changes?

I'm similarly curious if after one such migration is executed in production, should perhaps my CI/CD process commit new changes to the otherwise read-only seed.sql (via pg-dump or similiar)?
Was this page helpful?