As a full-stack developer, managing database backups is crucial for testing, development, and disaster recovery. pgAdmin, a popular GUI tool for PostgreSQL, simplifies backing up and restoring databases without needing command-line tools like pg_dump or pg_restore. This guide walks you through the process, using a real-world example of backing up a production database and restoring it locally or on a staging server.

Prerequisites

Step 1: Back Up the Database

  1. Connect to Your Database:

  2. Create the Backup:

  3. Verify the Backup: Check the file in your local directory:

    ls -lh /Users/yourname/prod_backup.sql.gz  # macOS/Linux
    dir C:\\Users\\yourname\\prod_backup.sql.gz   # Windows
    

Step 2: Restore the Database

  1. Set Up the Target Database:
  2. Restore the Data:
  3. Verify the Restore:

Step 3: Integrate with Your App

For a Prisma-based Node.js app: