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.
- SQL front matter, like
SETstatements are removed. CREATE SCHEMA publicis removed.- Comments (
--) and empty newlines are removed. - 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.sqlA bash version is also available:
./edit-pg-dump.sh filename.sql