graphql-engine/scripts/edit-pg-dump
Vishnu Bharathi P 58c44f55dd Merge oss/master onto mono/main
GitOrigin-RevId: 1c8c4d60e033c8a0bc8b2beed24c5bceb7d4bcc8
2020-11-12 22:37:19 +05:30
..
edit-pg-dump.sh Merge oss/master onto mono/main 2020-11-12 22:37:19 +05:30
index.go edit-pg-dump: fix a missing semi-colon 2019-04-09 09:24:59 +05:30
now.json add script and now.sh function to edit pg_dump output (close #1861) (#1884) 2019-03-27 21:36:58 +05:30
README.md update regex to delete event triggers in edit-pg-dump (close #1959) (#1960) 2019-04-08 15:59:11 +05:30

hasura-edit-pg-dump

This is a serverless function written in Go and deployed onto now.sh which can take the SQL output from pg_dump and clean it up so that it can be used as a migration file with Hasura.

  1. SQL front matter, like SET statements are removed.
  2. CREATE SCHEMA public is removed.
  3. Comments (--) and empty newlines are removed.
  4. Postgres triggers created by Hasura for event triggers are removed.

This app is available at https://hasura-edit-pg-dump.now.sh

Usage:

curl --data-binary @file.sql https://hasura-edit-pg-dump.now.sh > cleaned.sql

A bash version is also available:

./edit-pg-dump.sh filename.sql