Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add script and now.sh function to edit pg_dump output (close #1861) #1884

Merged
merged 1 commit into from
Mar 27, 2019

Conversation

shahidhk
Copy link
Member

@shahidhk shahidhk commented Mar 27, 2019

Description

This PR adds a bash script and a serverless function to clean up the output of pg_dump so that it can be used as a migration file for Hasura. This can be later integrated with the CLI so that the cleanup is handled by CLI.

Affected components

  • Scripts

Related Issues

#1861

Solution and Design

  • A serverless function written in Go gets the SQL content though HTTP POST.
  • A set of pre-defined lines are removed from this SQL string.
  • SQL comments are removed using regex matching.
  • Postgres triggers created by Hasura for use with event triggers are removed with regex matching.
  • Empty newlines are removed by regex matching.
  • Resulting string is returned in the HTTP response.

Steps to test and verify

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

Limitations, known bugs & workarounds

NA

@netlify
Copy link

netlify bot commented Mar 27, 2019

Deploy preview for hasura-docs ready!

Built with commit 14a9b66

https://deploy-preview-1884--hasura-docs.netlify.com

@shahidhk shahidhk added the c/community Related to community content label Mar 27, 2019
@shahidhk shahidhk merged commit 42a25f0 into hasura:master Mar 27, 2019
@hasura-bot
Copy link
Contributor

Review app https://hge-ci-pull-1884.herokuapp.com is deleted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/community Related to community content
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants