这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@jeffsieu
Copy link
Contributor

@jeffsieu jeffsieu commented Oct 16, 2019

Description

Adds a metadata diff command to show comparisons between two different sets of Hasura metadata.

# Show changes between server metadata and the exported metadata file:
hasura metadata diff

# Show changes between server metadata and that in local_metadata.yaml:
hasura metadata diff local_metadata.yaml

# Show changes between metadata from metadata.yaml and metadata_old.yaml:
hasura metadata diff metadata.yaml metadata_old.yaml

Also adds a --dry-run flag to metadata apply command which will print the diff and exit rather than actually applying the metadata.

Affected components

  • CLI
  • Docs

Related Issues

#3126

Solution and Design

  • Added metadata_diff.go and metadata_diff_test.go

Steps to test and verify

hasura metadata export
# Make changes to migrations/metadata.yaml
hasura metadata diff

Limitations, known bugs & workarounds

This is just a general-purpose diff.

A more contextual diff with the understanding of metadata can be added once #3072 is merged.

@jeffsieu jeffsieu requested a review from shahidhk as a code owner October 16, 2019 12:15
@hasura-bot
Copy link
Contributor

Beep boop! 🤖

Hey @jeffsieu, thanks for your PR!

One of my human friends will review this PR and get back to you as soon as possible.

Stay awesome! 😎

@CLAassistant
Copy link

CLAassistant commented Oct 16, 2019

CLA assistant check
All committers have signed the CLA.

@netlify
Copy link

netlify bot commented Oct 16, 2019

Deploy preview for hasura-docs ready!

Built with commit dbcd60e

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

@shahidhk shahidhk added c/cli Related to CLI hacktoberfest labels Oct 16, 2019
@shahidhk shahidhk self-assigned this Oct 16, 2019
@jeffsieu
Copy link
Contributor Author

jeffsieu commented Oct 21, 2019

@shahidhk I'm not too sure why the CI for test_cli_with_last_release fails...

@hasura-bot
Copy link
Contributor

Review app for commit 8f89f9b deployed to Heroku: https://hge-ci-pull-3157.herokuapp.com
Docker image for server: hasura/graphql-engine:pull3157-8f89f9be

@shahidhk shahidhk changed the title Add metadata-diff command (close #3126) add metadata-diff command (close #3126) Oct 21, 2019
@jeffsieu
Copy link
Contributor Author

Oh, it was because I accidentally updated the Gopkg files to download dependencies of different versions...

@shahidhk
Copy link
Member

Thanks @jeffsieu! I'll get back on the review today.

@hasura-bot
Copy link
Contributor

Review app for commit a980da7 deployed to Heroku: https://hge-ci-pull-3157.herokuapp.com
Docker image for server: hasura/graphql-engine:pull3157-a980da79

@hasura-bot
Copy link
Contributor

Review app for commit e073c53 deployed to Heroku: https://hge-ci-pull-3157.herokuapp.com
Docker image for server: hasura/graphql-engine:pull3157-e073c534

@shahidhk shahidhk changed the title add metadata-diff command (close #3126) add metadata-diff command (close #3126) (close #3127) Oct 22, 2019
@jeffsieu
Copy link
Contributor Author

@shahidhk Any updates? Or things I need to change for this PR?

@marionschleifer marionschleifer added the c/community Related to community content label Oct 27, 2019
@shahidhk shahidhk changed the title add metadata-diff command (close #3126) (close #3127) cli(metadata): add diff command and dry-run flag (close #3126) (close #3127) Oct 28, 2019
@shahidhk
Copy link
Member

All good @jeffsieu, I am just making some modifications from my end :) Thanks

@jeffsieu
Copy link
Contributor Author

@shahidhk Alright, cheers!

@hasura-bot
Copy link
Contributor

Review app for commit 118bee3 deployed to Heroku: https://hge-ci-pull-3157.herokuapp.com
Docker image for server: hasura/graphql-engine:pull3157-118bee37

@hasura-bot
Copy link
Contributor

Review app for commit dbcd60e deployed to Heroku: https://hge-ci-pull-3157.herokuapp.com
Docker image for server: hasura/graphql-engine:pull3157-dbcd60e2

@shahidhk shahidhk changed the title cli(metadata): add diff command and dry-run flag (close #3126) (close #3127) cli(metadata): add diff command and dry-run flag Oct 30, 2019
@shahidhk shahidhk merged commit 2ee7f7d into hasura:master Oct 30, 2019
@hasura-bot
Copy link
Contributor

Beep boop! 🤖

GIF

Awesome work @jeffsieu! All of us at Hasura ❤️ what you did.

Thanks again 🤗

@hasura-bot
Copy link
Contributor

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

polRk pushed a commit to polRk/graphql-engine that referenced this pull request Feb 12, 2020
### Description
Adds a `metadata diff` command to show comparisons between two different sets of Hasura metadata.
```
# Show changes between server metadata and the exported metadata file:
hasura metadata diff

# Show changes between server metadata and that in local_metadata.yaml:
hasura metadata diff local_metadata.yaml

# Show changes between metadata from metadata.yaml and metadata_old.yaml:
hasura metadata diff metadata.yaml metadata_old.yaml
```

Also adds a `--dry-run` flag to `metadata apply` command which will print the diff and exit rather than actually applying the metadata.

### Affected components 
- CLI
- Docs

### Related Issues
Close hasura#3126, Close hasura#3127

### Solution and Design
- Added `metadata_diff.go` and `metadata_diff_test.go`


### Steps to test and verify
```
hasura metadata export
# Make changes to migrations/metadata.yaml
hasura metadata diff
```

### Limitations, known bugs & workarounds
This is just a general-purpose diff. 

A more contextual diff with the understanding of metadata can be added once hasura#3072  is merged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c/cli Related to CLI c/community Related to community content

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants