© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago
zackderose

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)?
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Baselining Migrations -- Local
SupabaseSSupabase / help-and-questions
5mo ago
Local <--> Remote Migrations Help
SupabaseSSupabase / help-and-questions
3y ago
Functions defined in the migrations are not found in the seed.sql
SupabaseSSupabase / help-and-questions
4y ago
How to use seed.sql to populate the local supabase instance?
SupabaseSSupabase / help-and-questions
3y ago