Skip to main content

Pushing Local Changes to Prod Environment

  1. Make database changes to the local supabase dashboard or wherever
  2. Create a new migration by running
supabase db diff -f insert_good_migration_name_here
  1. Review the generated migration file and ensure all the changes expected changes
  2. Reset your local database to ensure the migration works as expected
supabase db reset
  1. Once you've tested everything now you can push your migrations
supabase db push
warning

supabase db push will update the production environment. REALLY make sure it doesn't break anything before you run this command.

  1. Generate updated TypeScript types from the database schema

For production database:

npx supabase gen types typescript --project-id "$PROJECT_REF" --schema public > ./nextjs/types_db.ts

For local database:

npx supabase gen types typescript --local --schema public > ./nextjs/types_db.ts
  1. For deploying Supabase Edge functions from the local changes to the production environment, run the following command at the root of the application:
supabase functions deploy