No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2025-03-23 06:11:32 -06:00
.github Deleted .github/workflows/rebase.yml 2025-03-23 06:11:32 -06:00
backups Updated the backup. 2020-10-25 13:49:05 -04:00
.gitignore Initial commit. 2020-10-23 02:09:28 -04:00
.whitesource Added .whitesource 2021-07-02 12:52:34 -04:00
action.yml chore(deps): update tj-actions/install-postgresql action to v3 2023-11-29 23:39:16 +00:00
CODE_OF_CONDUCT.md Added CODE_OF_CONDUCT.md 2021-07-02 16:43:52 -04:00
CONTRIBUTING.md Initial commit. 2020-10-23 02:09:28 -04:00
HISTORY.md Upgraded from v5.0 -> v6 2024-01-06 20:03:35 +00:00
LICENSE Initial commit. 2020-10-23 02:09:28 -04:00
README.md Updated README.md (#198) 2025-02-13 21:30:05 -07:00

Ubuntu Mac OS Windows Public workflows that use this action.

Codacy Badge CI Update release version.

pg-restore

Restore a postgres service container using a sql backup file with psql.

[!NOTE]

  • This only supports sql backups.

Prerequisite

Create a backup using

$ cd [project_root]
$ mkdir backups
$ pg_dump -O -f backups/backup.sql $DATABASE_URL

See: https://github.com/tj-actions/pg-dump

Usage

Using the default PostgreSQL installed on the runner

...
    steps:
      # Checkout the repository
      - uses: actions/checkout@v4

      # Run pg-restore
      - name: Postgres Backup Restore
        uses: tj-actions/pg-restore@v6
        with:
          database_url: "postgres://test_user:test_password@localhost:5432/test_db"
          backup_file: "backups/backup.sql"

Using a different PostgreSQL version

...
    steps:
      # Checkout the repository
      - uses: actions/checkout@v2

      # Run pg-restore
      - name: Postgres Backup Restore
        uses: tj-actions/pg-restore@v6
        with:
          database_url: "postgres://test_user:test_password@localhost:5432/test_db"
          backup_file: "backups/backup.sql"
          postgresql_version: "15"  # Note: Only the major version is required e.g. 12, 14, 15

Inputs

INPUT TYPE REQUIRED DEFAULT DESCRIPTION
backup_file string true Backup file name
database_url string true Database URL
options string false Extra options to pass directly
to psql
postgresql_version string false Version of PostgreSQL. e.g 15

If you feel generous and want to show some extra appreciation:

Buy me a coffee

Credits

This package was created with Cookiecutter.

Report Bugs

Report bugs at https://github.com/tj-actions/pg-restore/issues.

If you are reporting a bug, please include:

  • Your operating system name and version.
  • Any details about your workflow that might be helpful in troubleshooting.
  • Detailed steps to reproduce the bug.