Sync merged GitHub pull requests to PostgreSQL

Developer ToolDocument/FileSales EnablementDatabaseMarketing

What it does

When a pull request is merged in GitHub with the title testbranch_1, this automation lists the files and filters for SQL files. Someone can then download them from Google Drive to update PostgreSQL rows.

Who it's for

Engineering teams who need to version control database schema changes through GitHub pull requests.

How teams use this

Version control database schema changes

Merge a pull request with SQL files in GitHub, and this automation uploads them to Google Drive for review. The team then downloads and applies changes to PostgreSQL without manual file handling.

Automate schema deployment to staging

Add a PostgreSQL connection step to execute the SQL files against a staging database. Include a condition to check the branch name and only deploy when the pull request targets a specific branch.

Notify the team of schema updates

Retarget this automation to send a Slack message listing the SQL files and their changes when a pull request is merged. The notification channel changes from Google Drive to Slack.

Alert database administrators of changes

Set up a filter to only process pull requests from specific team members, then notify database administrators in Slack with the SQL file details. This ensures the right people review schema changes before they reach PostgreSQL.

How it works

  1. Detect merged pull request. A pull request is merged in GitHub with the title testbranch_1, and this automation runs in real time to process the attached files.
  2. List pull request files. List pull request files in GitHub to retrieve all files attached to the merged pull request for processing.
  3. Filter and retrieve SQL files. For each file, check if the filename contains .sql, then get blob in GitHub to retrieve the file contents of matching SQL files.
  4. Upload SQL files to Google Drive. Upload each SQL file to Google Drive so the team can access and review the schema changes before applying them to PostgreSQL.