Skip to main content

Production Deployment Checklist

Pre-Deployment

  • Staging is working correctly
  • All migrations tested on staging
  • Code committed to git
  • Backup production database (optional but recommended)

Deployment Steps

1. Commit Your Changes

# Review what will be committed
git status

# Add relevant files (exclude .env files)
git add scripts/deploy-to-production.sh
git add scripts/deploy-to-staging.sh
git add src/hooks/useMenuCategories.tsx
git add src/hooks/useUnifiedDishes.tsx
# Add any other code changes

# Commit
git commit -m "Deploy: Fix menu filtering and migration deployment scripts"

# Push to remote
git push

2. Run Production Deployment

./scripts/deploy-to-production.sh

The script will:

  • Link to production
  • Attempt to push migrations
  • If migration history mismatch occurs, it will offer to generate cleanup SQL

3. Handle Migration History Mismatch (if needed)

If you see "Remote migration versions not found" error:

Option A: Generate and run cleanup SQL (Recommended)

  1. Choose option 1 when prompted
  2. Review the generated SQL file: scripts/delete-production-migrations-generated.sql
  3. Go to: https://supabase.com/dashboard/project/zvyvpucxdnftgrixxrxy/sql
  4. Switch to 'postgres' role (top-right dropdown)
  5. Run the SELECT query first to preview what will be deleted
  6. Uncomment and run the DELETE statement
  7. Retry the deployment script

Option B: Continue without fixing (migrations will still apply)

  • Choose option 2 when prompted
  • Migrations will be applied but you may see errors
  • You can fix history later

4. Verify Deployment

After migrations are pushed:

  1. Check Supabase Dashboard:

  2. Test Application:

    • Test critical features
    • Verify Menu Overview page filters correctly
    • Check for console errors
    • Test RLS policies
  3. Monitor:

    • Watch error logs for 24-48 hours
    • Monitor user feedback
    • Check application performance

Troubleshooting

Migration History Mismatch

Symptom: Remote migration versions not found in local migrations directory

Solution: Use the SQL cleanup approach (see step 3 above)

RLS Policies Not Working

Symptom: 403 Forbidden errors or data not filtering correctly

Solution:

  1. Check if RLS is enabled on tables
  2. Verify policies are correct
  3. Check user roles and permissions

Migrations Not Applying

Symptom: Schema changes not appearing in production

Solution:

  1. Check Supabase dashboard for migration errors
  2. Review migration files for syntax errors
  3. Verify database connection

Important Notes

  • ⚠️ Production was cloned without migration history - This is expected
  • Migrations will still apply - Even if history is missing
  • 🔧 History can be fixed later - Using SQL cleanup approach
  • 📊 Monitor closely - Watch for errors after deployment

Quick Reference

Post-Deployment

  • Verify all migrations applied
  • Test critical user flows
  • Monitor error logs
  • Check application performance
  • Document any issues encountered