Commit Graph

29 Commits

Author SHA1 Message Date
Brandon Simmons
6e8da71ece server: migrate to aeson-2 in preparation for ghc 9.2 upgrade
(Work here originally done by awjchen, rebased and fixed up for merge by
jberryman)

This is part of a merge train towards GHC 9.2 compatibility. The main
issue is the use of the new abstract `KeyMap` in 2.0. See:
https://hackage.haskell.org/package/aeson-2.0.3.0/changelog

Alex's original work is here:
#4305

BEHAVIOR CHANGE NOTE: This change causes a different arbitrary ordering
of serialized Json, for example during metadata export. CLI users care
about this in particular, and so we need to call it out as a _behavior
change_ as we did in v2.5.0. The good news though is that after this
change ordering should be more stable (alphabetical key order).

See: https://hasurahq.slack.com/archives/C01M20G1YRW/p1654012632634389

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4611
Co-authored-by: awjchen <13142944+awjchen@users.noreply.github.com>
GitOrigin-RevId: 700265162c782739b2bb88300ee3cda3819b2e87
2022-06-08 15:32:27 +00:00
Aravind K P
2ff0f25e08 cli: refactor metadataobject package
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3943
GitOrigin-RevId: 4cc8f67dd8b6ba0e78f1c35d415f89bd1b901705
2022-03-10 08:13:50 +00:00
hasura-bot
f530b3ac6f cli: fix regression with --address flag of hasura console command
GITHUB_PR_NUMBER: 8039
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/8039
closes https://github.com/hasura/graphql-engine/issues/8005

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3381
Co-authored-by: Shoki Hata <37888628+sho-hata@users.noreply.github.com>
Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com>
GitOrigin-RevId: 6ca7c091ebf7c240e97b65fbfc1713cccb5a5b82
2022-01-20 06:41:05 +00:00
Kali Vara Purushotham Santhati
f0bef2b482 cli: add All option for migrate sub-commands (apply, delete and status) and seed apply command
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2509
Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com>
GitOrigin-RevId: 03ee878072b58c6dc7f43af9d26d30a5594d9a50
2021-12-23 15:59:56 +00:00
Aravind K P
0c7e233125 cli: revert split remote schema permissions metadata into seperate files
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3123
GitOrigin-RevId: f327c7324edd66e1f57fafe7703c3318e1362049
2021-12-14 05:08:08 +00:00
Kali Vara Purushotham Santhati
1e5a48286f cli: split remote schema permissions metadata into seperate files
closes https://github.com/hasura/graphql-engine/issues/7033

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/1877
Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com>
GitOrigin-RevId: 3764db9102d41f67a43f76aa79d28eb5485579ca
2021-10-14 06:52:57 +00:00
Kali Vara Purushotham Santhati
94a3be3e6e cli: fix lint errors
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/1749
Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com>
GitOrigin-RevId: 4515f7f2c58b7f28645b2c5a5d9842aa7a844eae
2021-10-13 14:39:15 +00:00
Kali Vara Purushotham Santhati
f47095ff55 cli: init --endpoint intializes the project with metadata and migrations from HGE
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2409
Co-authored-by: Ajay Tripathi <24985760+atb00ker@users.noreply.github.com>
Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com>
GitOrigin-RevId: 06bb3462ffe1604b80a4afde241568790aaa6704
2021-10-07 14:24:52 +00:00
Kali Vara Purushotham Santhati
b75ab7233e cli: fix data-race warnings
#### Issue: https://github.com/hasura/graphql-engine-mono/issues/2179

### Problem:

1. There are few warnings when tests are executed with cli if it is built with `race` flag
It is because of a race condition between stdin in migrate_delete for the prompt and stdout for other commands.

2. The integration test of the console used to behave as follows:
    ```
     - Initially there won't be any wg.adds in wait-group so the second go-routine created in console-test (integration-test)
     - It will send the interrupt signal to the channel before the server has been started
     - So practically the server won't start
    ```
3. The read and write for consoleopts.WG has been happening in different go-routines without control or lock system(reading and writing into same memory location without lock system). So there is a chance of data-race(warning for data-race while integration tests are executed)
4. Data-race errors from `promptui` package

### Solution:

1. Use `--force` flag to avoid getting the input from the prompt in `migrate_delete_test.go`
2. Introduced two fields in server and console opts to let know other go-routines whether the server has been started or not
3. To avoid data-race above which are shared b/w go-routines to know the status of servers has been operated atomically.
4. using new package https://github.com/AlecAivazis/survey

https://github.com/hasura/graphql-engine-mono/pull/2231

GitOrigin-RevId: 387eb1be74f24dda34bb3588314b5a909adac227
2021-09-07 13:34:54 +00:00
Aravind K P
c7ac1ede3f cli: add migrate and metadata packages
>

### Description
>
This PR adds two new packages which implement the CLI requirements specified in RFC:https://github.com/hasura/lux/blob/cloud/docs/rfcs/20210614_github_integration.md

1. `pkg/metadata`

![image](https://user-images.githubusercontent.com/8335904/122384828-b4757d80-cf89-11eb-9e21-ef116fb928e9.png)

2. `pkg/migrate`

![image](https://user-images.githubusercontent.com/8335904/122510554-68771700-d023-11eb-9f5d-046d2c0cf18a.png)

### Changelog

- [x] `CHANGELOG.md` is updated with user-facing content relevant to this PR. If no changelog is required, then add the `no-changelog-required` label.

### Affected components

- [x] CLI

https://github.com/hasura/graphql-engine-mono/pull/1598

GitOrigin-RevId: 0e2bce498386c5aae68dbca0fe383a6afff9d1a9
2021-06-18 06:25:14 +00:00
Aravind K P
3136ffad1b cli: update go.mod
>

### Description
Update `go.mod` to allow other packages to import [v2.0.0 versions](https://blog.golang.org/v2-go-modules).

### Changelog

- [x] `CHANGELOG.md` is updated with user-facing content relevant to this PR. If no changelog is required, then add the `no-changelog-required` label.

### Affected components

- [x] CLI

https://github.com/hasura/graphql-engine-mono/pull/1584

GitOrigin-RevId: a5d17ad20289d1cd7217763f56ef3ba6552d69c4
2021-06-16 11:45:07 +00:00
Kali Vara Purushotham Santhati
8bfc56b7c4 cli: remove the unnecessary empty lines in actions.graphql generated by metadata export command
closes https://github.com/hasura/graphql-engine/issues/5338

GitOrigin-RevId: 83bd8492beb9f52c761d5857ca369425c69691a4
2021-06-09 10:46:05 +00:00
Kali Vara Purushotham Santhati
8edd3f03a5 cli: using forward slash as filepath separator irrespective of os.
Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com>
GitOrigin-RevId: 6ad93a11830868a05a1c02333d482a2978b704c2
2021-05-19 03:36:23 +00:00
Vishnu Bharathi
ebc01c2378 cli, ci: enables docker based tests
Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com>
GitOrigin-RevId: d7a53e512d296bdd4b2119bb1d0b89e30da7d476
2021-05-17 00:30:08 +00:00
Kali Vara Purushotham Santhati
489835eb36 cli: metadata apply,export enhancements
- modified the `dry-run` flag of metadata apply command.
- added new flag `o` which takes "json" or "yaml" as parameters for metadata apply command.
- added new flag `o` which takes "json" or "yaml" as parameters for metadata export command. It outputs the metadata from server to stdout in form of  json or yaml and won't change the project's metadata.
- added deprecation warnings for `--from-file` flag
- added info message for describing change of behavior of `--dry-run` flag
- v3 metadata objects like `rest_endpoints` was also added to list of metadata objects in config v2 (fix)
- the order in which metadata objects are appended to metadata objects list matter when using `--dry-run` flag, refactored this order to match server metadata.
- `metadata apply` command can now accept json/yaml metadata from io pipe
- config v3 `metadata apply` didn't show any information to user when applied metadata is inconsistent, this is addressed.
- removed `github.com/ghodss/yaml` dependency from repo
- version metadata object was added twice during intialization (fix)

Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com>
GitOrigin-RevId: 2316f519eb40645efd86ffee2a85d3c90543ec17
2021-05-14 19:09:59 +00:00
Aravind K P
cc3539415b cli: fix seeds incorrectly being applied to databases
GitOrigin-RevId: cce2612ddfd90d1fd10a0a3561d24c64569a6935
2021-04-01 10:39:53 +00:00
Aravind K P
f6ca551df4 cli: support mssql sources
GitOrigin-RevId: 4b1a63c8dc342ae4001b16c4b1dce282092d5c6f
2021-03-08 12:00:34 +00:00
Aravind K P
a0995d1b30 cli: add client package, statestore implementations, deprecate config v1
GitOrigin-RevId: 5a1d9cb772ac62603f2543bfe6c01a95c0a035c6
2021-02-17 04:21:11 +00:00
Aravind K P
3d5b30ce01 cli: fix metadata export behavior of config v2 with a v3 metadata server
GitOrigin-RevId: 76d1d01cee55f950cba3184dd57655c922a8d011
2021-02-15 15:15:44 +00:00
hasura-bot
a398d3b190 cli: support datasources
GITHUB_PR_NUMBER: 6111
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/6111

Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com>
GitOrigin-RevId: 1f6517acfacb58c566bb5e48f74ea0dfa5c6f063
2021-01-18 17:12:09 +00:00
Ayan Banerjee
fd36bd1492
cli: fix lint issues for v2/integration_test/seeds.go (#5954)
https://github.com/hasura/graphql-engine/pull/5954
2020-10-29 06:13:53 +00:00
Aravind
6486a4f0ec
cli: when applying metadata, assume empty metadata plugin files if they don't exist (close #5163) (#5170) 2020-06-24 16:08:48 +05:30
Aravind
1f2037947d
cli: manage seed migrations as sql files (close #2431) (#3763) 2020-06-16 17:45:04 +05:30
Aravind
5a648a9bb2
cli: fix cron triggers not being exported on a metadata export (close #5047) (#5060) 2020-06-16 14:38:36 +05:30
Aravind Shankar
455b78552d
cli(test): refactor integration test metadata directory (#4491) 2020-04-22 16:58:02 +05:30
Aravind Shankar
2a693be553
cli(test): fix cli init test to use initDir from subtest group (#4490) 2020-04-22 15:54:24 +05:30
Rishichandra Wawhal
9b66724b41
console, cli, cli-ext: query support for actions (close #4032) (#4318)
Co-authored-by: Aravind Shankar <aravind@hasura.io>
2020-04-13 15:51:53 +05:30
Aravind Shankar
09e0e2f2a5
cli: fix init command to generate correct config (fix #4036) (#4038) 2020-03-26 08:54:05 +05:30
Aravind Shankar
bb63d7e60e
cli: allow managing actions (#3859)
Co-authored-by: Rishichandra Wawhal <rishichandra.wawhal@gmail.com>
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
Co-authored-by: Aravind <aravindkp@outlook.in>
Co-authored-by: Anon Ray <ecthiender@users.noreply.github.com>
Co-authored-by: Shahidh K Muhammed <muhammedshahid.k@gmail.com>
2020-02-24 21:44:46 +05:30