Commit Graph

1291 Commits

Author SHA1 Message Date
Brandon Simmons
84cfe18b3c dev.sh: combine tix from unit/haskell tests and integration tests in final report 2019-11-14 18:53:33 -05:00
Brandon Simmons
505ea4deef dev.sh: support running only integration tests or haskell/unit tests individually 2019-11-14 18:53:33 -05:00
Brandon Simmons
256be84dba dev.sh script: build before waiting for PG 2019-11-14 18:53:33 -05:00
Brandon Simmons
5827d652f6 In dev.sh tests: use postgres:11.5-alpine-postgis image which boots 3 sec faster 2019-11-14 18:53:33 -05:00
Brandon Simmons
9e0e42444b Add 'venv' to top gitignore, as standard name convention lsfor python venv's in this project 2019-11-14 18:53:33 -05:00
Brandon Simmons
a1da8bcfdd Fix product_mul_price test
The intention was to make this two cases, using a top-level YAML list.
The result was one test with duplicate keys (effectively only running
the second test). This is an error that's now flagged by newer ruamel.

Both tests needed to be "corrected" to pass and need review.
2019-11-14 18:53:33 -05:00
Brandon Simmons
92b1f9c93d In tests: fix extraneous extra keys in yaml 2019-11-14 18:53:33 -05:00
Brandon Simmons
da78a77fb2 In tests/dev.sh: upgrade ruamel to support python 3.7. Closes #3312
Tested on python 3.5 and 3.7

We make light use of pyenv to set an appropriate python version if
installed. We could easily install a correct version too if we wanted
but that seemed invasive.

The newer ruamel was an annoying upgrade but also offers some
improvements that exposed some test suite issues (fixed later).
2019-11-14 18:53:33 -05:00
Maharaj Brahma
638dce542f fix grammar, typo in some md files (#3089) 2019-11-14 13:26:50 +05:30
Juan Manuel Méndez Rey
30b343d37d docs: fix typo (#3321) 2019-11-14 13:21:16 +05:30
SanyuktaSaha
058323b4a5 updated remote-schemas.md (#2977) 2019-11-14 13:20:25 +05:30
Samesh Lakhotia
da2db05a26 docs: fix typos (#3278)
`can deployed` -> `can be deployed`
Remove tautology: `exact same` -> `same`
2019-11-14 13:19:34 +05:30
Shahidh K Muhammed
98911df54e update manifests to v1.0.0-beta.10 2019-11-14 11:20:09 +05:30
Tirumarai Selvan
ffeda35ff7 add few x-forwarded- headers (close #2572) (#3347) 2019-11-13 14:25:11 -06:00
Tirumarai Selvan
3cad1319c4 improve event fetch query (#3236) 2019-11-13 12:59:19 +05:30
Rikin Kachhia
bd3eeed9fc
update console error page image paths (#3340) 2019-11-12 19:15:26 +05:30
ap
f36587a7de add reload metadata instructions in docs (close #2004) (#3264) 2019-11-12 18:39:00 +05:30
Rikin Kachhia
689c97e9a1
improve migration detection logic in Raw SQL page (close #3266) (#3306) 2019-11-11 14:25:10 +05:30
Rikin Kachhia
4178230d93
get user confirmation before executing 'Track All' in console (close #3318) (#3323) 2019-11-08 19:32:44 +05:30
Rakesh Emmadi
3888ceb24a computed fields in export/import metadata, other fixes (#3211) 2019-11-07 20:09:48 +05:30
ap
5832adae73 escape params in console data section routes (close #3164) (#3275) 2019-11-07 17:54:23 +05:30
Rakesh Emmadi
37dd0966d0 fix insert with nested returning clause fails alongside text[] column (fix #3148 & #2520) (#3198) 2019-11-06 23:14:36 -06:00
Rishichandra Wawhal
3a07b2b0cf handle table configuration defaults in console (fix #3313 #3314 #3316) (#3317) 2019-11-07 08:27:27 +05:30
Rishichandra Wawhal
a1a851b3d1 support customising GraphQL fields from console (#3175) 2019-11-06 20:00:00 +05:30
cheater
637c2cb555 fix server dev script (close #3246) (#3257)
Signed-off-by: cheater <195390+cheater@users.noreply.github.com>
2019-11-06 13:10:46 +05:30
Bepitan
84d35667b8 improve french translation for CONTRIBUTING.md (#3255) 2019-11-06 13:09:35 +05:30
Anwari Ilman
781fdbf5c6 fix: replace folder community/examples into community/sample-apps (#3281) 2019-11-06 13:08:46 +05:30
Varshit Shah
64b52451c2 typo(docs): allow list page (#3295)
Fix typo: `practises` to `practices`
2019-11-06 13:08:14 +05:30
Rakesh Emmadi
1b96ebc7d2 deterministic ordering of objects in exported metadata (close #3125) (#3230)
* deterministic ordering of objects in exported metadata, close #3125
* refactor 'Hasura.RQL.DDL.Metadata'
2019-11-05 20:11:03 -06:00
Alexis King
70a1ca6bd8
Merge pull request #2831 from jberryman/brandon-test-yaml-fixups
Test result ordering, add `--accept` test mode to automatically accept new/changed test cases
2019-11-05 16:14:48 -06:00
Brandon Simmons
008a3df359 Comment flaky test_jsonb_has_all test 2019-11-05 15:15:25 -06:00
Brandon Simmons
a89777c808 Fix result ordering in some incorrect tests
These were generated with `--accept` and inspected individually.

Mark failing cases as xfail: #3271
2019-11-05 15:15:25 -06:00
Brandon Simmons
91aee7fdeb Test result ordering, add --accept test mode to automatically accept changed test cases
We add a new pytest flag `--accept` that will automatically write back
yaml files with updated responses. This makes it much easier and less
error-prone to update test cases when we expect output to change, or
when authoring new tests.

Second we make sure to test that we actually preserve the order of the
selection set when returning results. This is a "SHOULD" part of the
spec but seems pretty important and something that users will rely on.

To support both of the above we use ruamel.yaml which preserves a
certain amount of formatting and comments (so that --accept can work in
a failry ergonomic way), as well as ordering (so that when we write yaml
the order of keys has meaning that's preserved during parsing).

Use ruamel.yaml everywhere for consistency (since both libraries have
different quirks).

Quirks of ruamel.yaml:
- trailing whitespace in multiline strings in yaml files isn't written
  back out as we'd like: https://bitbucket.org/ruamel/yaml/issues/47/multiline-strings-being-changed-if-they
- formatting is only sort of preserved; ruamel e.g. normalizes
  indentation. Normally the diff is pretty clean though, and you can
  always just check in portions of your test file after --accept

fixup
2019-11-05 15:15:25 -06:00
Brandon Simmons
81fe4a23cf Test fixup: 'yes' being YAML synonym for 'true' is dubious
See: https://stackoverflow.com/q/57682657/176841

I don't think this is something we care about, and we need to fix this
for ruamel which uses the more sane v1.2 spec.
2019-11-05 15:15:25 -06:00
Rikin Kachhia
d17068eb24
show only tracked tables during event trigger creation in console (close #3225) (#3227) 2019-11-05 16:27:28 +05:30
Shahidh K Muhammed
84eb09c1d2 update manifests to v1.0.0-beta.9 2019-10-31 14:29:32 +05:30
Aravind Shankar
980c65dbe2 cli(migrations): new folder structure and squash (#3072)
### Description
This PR introduces three new features:

- Support for a new migrations folder structure.
- Add `squash` command in preview.
- ~List of migrations on the Console and ability to squash them from console.~

#### New migrations folder structure

Starting with this commit, Hasura CLI supports a new directory structure for migrations folder and defaults to that for all new migrations created. 

Each migration will get a new directory with the name format `timestamp_name` and inside the directory, there will be four files:

```bash
└── migrations
    ├── 1572237730898_squashed
    │   ├── up.sql
    │   ├── up.yaml
    │   ├── down.yaml
    │   └── down.sql
```

Existing files old migration format `timestamp_name.up|down.yaml|sql` will continue to work alongside new migration files.

#### Squash command

Lots of users have expressed their interest in squashing migrations (see #2724 and #2254) and some even built [their own tools](https://github.com/domasx2/hasura-squasher) to do squash. In this PR, we take a systematic approach to squash migrations.

A new command called `migrate squash` is introduced. Note that this command is in **PREVIEW** and the correctness of squashed migration is not guaranteed (especially for down migrations). From our tests, **it works for most use cases**, but we have found some issues with squashing all the down migrations, partly because the console doesn't generate down migrations for all actions.

Hence, until we add an extensive test suite for squashing, we'll keep the command in preview. We recommend you to confirm the correctness yourself by diffing the SQL and Metadata before and after applying the squashed migrations (we're also thinking about embedding some checks into the command itself).

```bash
$ hasura migrate squash --help
(PREVIEW) Squash multiple migrations leading upto the latest one into a single migration file

Usage:
  hasura migrate squash [flags]

Examples:
  # NOTE: This command is in PREVIEW, correctness is not guaranteed and the usage may change.

  # squash all migrations from version 1572238297262 to the latest one:
  hasura migrate squash --from 1572238297262

Flags:
      --from uint             start squashing form this version
      --name string           name for the new squashed migration (default "squashed")
      --delete-source         delete the source files after squashing without any confirmation
```

### Affected components 
<!-- Remove non-affected components from the list -->

- CLI

### Related Issues
<!-- Please make sure you have an issue associated with this Pull Request -->
<!-- And then add `(close #<issue-no>)` to the pull request title -->
<!-- Add the issue number below (e.g. #234) -->
Close #2724, Close #2254, 

### Solution and Design
<!-- How is this issue solved/fixed? What is the design? -->
<!-- It's better if we elaborate -->

For the squash command, a state machine is implemented to track changes to Hasura metadata. After applying each action on the metadata state, a list of incremental changes is created.

### Steps to test and verify
1. Open console via cli and create some migrations.
2. Run `hasura migrate squash --from <version>`

### Limitations, known bugs & workarounds
<!-- Limitations of the PR, known bugs and suggested workarounds -->

<!-- Feel free to delete these comment lines -->
- The `squash` command is in preview
- Support for squashing from the console is WIP
- Support for squashing migrations that are not committed yet is planned.
- Un-tracking or dropping a table will cause inconsistent squashed down migration since console doesn't generate correct down migration.
- If cascade setting is set to `true` on any of the metadata action, generated migration may be wrong
2019-10-31 07:51:15 +05:30
Alexis King
d6a649095c
Build server in CI with optimizations, even in pull requests (#3240) 2019-10-30 11:07:57 -05:00
Jeff Sieu
2ee7f7d76e cli(metadata): add diff command and dry-run flag (#3157)
### 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 #3126, Close #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 #3072  is merged.
2019-10-30 19:24:22 +05:30
Bharath Shendre
ed093cdc7e update event-triggers.md (#2989) 2019-10-30 08:21:42 +05:30
Shahidh K Muhammed
a9107a2fc3 console (make): fix gcs bucket name (close #3026) (#3260) 2019-10-28 12:15:16 +05:30
Rikin Kachhia
fcf03919de
add docs page for setting up unauthenticated acess (#3231) 2019-10-28 11:46:25 +05:30
Shahidh K Muhammed
ba751450be change pg_dump version to 12 in server makefile (#3249) 2019-10-26 12:03:54 -05:00
Shahidh K Muhammed
31e0225230
add tests with postgres 12 (close #2749) (#3102) 2019-10-26 11:09:57 +05:30
Rakesh Emmadi
6daa1bb330 update pr template with server breaking changes checklist (#2932) 2019-10-26 09:54:20 +05:30
Akshit Sarin
0b99930a7b Fix typo in CONTRIBUTING.md file (#3043) 2019-10-26 09:52:44 +05:30
Sameer Tulshyan
e09826b23a community(sample-apps): mod firebase-jwt html (#3044) 2019-10-26 09:51:55 +05:30
Low Jeng Lam
3b3e79b1cd fixed typo 'SCHEMA' (#3054) 2019-10-26 09:45:57 +05:30
Shivam175
aa6947a608 fix grammar in docs (#3065) 2019-10-26 09:43:38 +05:30
LOLDeveloper
251f861787 fixed some grammer mistakes in docs (#3027) 2019-10-26 09:37:37 +05:30