Commit Graph
100 Commits
Author SHA1 Message Date
Wolfgang WaltherandWolfgang Walther 8cde90b7fe refactor: Use include_triggers argument to pg_relation_is_updatable instead of manual check 2021-10-26 19:15:02 +02:00
Wolfgang WaltherandSteve Chavez b05898d17f fix: Return array of objects for RPCs with single-column TABLE return type
This is a regression after changing responses for RPCs with INOUT or OUT arguments in #1615.

Resolves #1930.
2021-09-02 10:13:03 -05:00
Wolfgang WaltherandRemo 5874482f03 nix(fix): Database cluster not cleaned up before artifact upload 2021-08-15 12:35:52 +02:00
Wolfgang WaltherandRemo 0511e99dd4 nix(refactor): Add withPath to checkedShellScript 2021-08-15 12:35:52 +02:00
Wolfgang WaltherandWolfgang Walther 4ded01b104 nix(fix): Fix missed devtools->devTools renaming 2021-04-24 15:25:10 +02:00
Wolfgang WaltherandWolfgang Walther c691b37f76 nix(feat): Create all temporary directories with script name template
Temporary directories are now created in $TMPDIR/postgrest/script-name-XXX. This allows recognizing the origin of a single temporary directory and uploading the whole $TMPDIR/postgrest folder as an artifact in CI.
2021-04-24 15:07:13 +02:00
Wolfgang WaltherandWolfgang Walther 14ddecc81a nix(fix): Avoid rebuilding during postgrest-coverage 2021-04-24 15:07:13 +02:00
Wolfgang WaltherandWolfgang Walther 3611eab39c nix(fix): Make postgrest-dump-schema work in nix-shell --pure 2021-04-24 15:07:13 +02:00
Wolfgang WaltherandWolfgang Walther e5350d2d50 nix(refactor): Split cabalTools from devtools
This allows to use `postgrest-build` in CI without pulling in a lot of dependencies.
2021-04-24 15:07:13 +02:00
Wolfgang WaltherandWolfgang Walther 249d4117e0 nix(style): reorder tools in default.nix 2021-04-24 15:07:13 +02:00
Wolfgang WaltherandWolfgang Walther ba47a54293 nix(refactor): Make with_tmp_db true checkedShellScript
This extends the interface of withTmpDb to allow loading different sets
of database fixtures via `postgrest-with-postgresql-xx --fixtures
<path>`.
2021-04-24 15:07:13 +02:00
Wolfgang WaltherandWolfgang Walther 7ca0d46936 nix(fix): Fix postgrest-push-cachix in nix-shell --pure 2021-04-18 13:51:39 +02:00
Wolfgang WaltherandWolfgang Walther b566481477 nix(refactor): Move shell scripts to subdirectory nix/tools 2021-04-18 13:51:39 +02:00
Wolfgang WaltherandWolfgang Walther fe497fc438 nix(refactor): Add buildToolbox to streamline module interface towards shell.nix 2021-04-18 13:51:39 +02:00
Wolfgang WaltherandWolfgang Walther de73ced34a nix(feat): Change memoryTests shell argument to memory
Avoids confusion with `memoryTest`.
2021-04-18 13:51:39 +02:00
Wolfgang WaltherandWolfgang Walther bc879507ae nix(fix): Make naming of tools in postgrest-release- namespace consistent 2021-04-18 13:51:39 +02:00
Wolfgang WaltherandWolfgang Walther 280b89d87c lint: Apply shellcheck suggestions for bash scripts in test/* 2021-04-18 13:51:39 +02:00
Wolfgang WaltherandWolfgang Walther eee5d5d482 nix(feat): Add shellcheck to postgrest-lint for bash scripts in test/* 2021-04-18 13:51:39 +02:00
Wolfgang WaltherandWolfgang Walther 2e73886adc nix(refactor): Split memoryTest from tests.nix into memory.nix 2021-04-18 13:51:39 +02:00
Wolfgang WaltherandWolfgang Walther e199337a53 nix(feat): Check required environment variables in postgrest-release tools 2021-04-18 13:51:39 +02:00
Wolfgang WaltherandWolfgang Walther 2417cfb02f nix(feat): Force optional arguments to go before positional arguments in argbash scripts
This improves passing subcommands to postgrest-with- tools.
2021-04-18 13:51:39 +02:00
Wolfgang WaltherandWolfgang Walther 2559d32912 nix(feat): Add argbash bash completion support 2021-04-18 13:51:39 +02:00
Wolfgang WaltherandWolfgang Walther c2df7d8198 nix(fix): Avoid losing exit trap through subcommand in postgrest-with-all 2021-04-18 13:51:39 +02:00
Wolfgang WaltherandWolfgang Walther c8edfac39e nix(feat): Add argbash support to checked-shell-script
Each postgrest- script now has a -h/--help option showing the
checked-shell-script.docs argument.

Additional CLI arguments can be defined through the
checked-shell-script.args argument using the argbash template syntax:
https://argbash.readthedocs.io/en/stable/guide.html
2021-04-18 13:51:39 +02:00
Wolfgang WaltherandWolfgang Walther 39d4646a4c nix(refactor): Add withEnv to checked-shell-script 2021-04-18 13:51:39 +02:00
Wolfgang WaltherandWolfgang Walther 40b1dccc54 nix(fix): Load withTmpDb into nix to have shellcheck run on it 2021-04-18 13:51:39 +02:00
Wolfgang WaltherandWolfgang Walther 32bac81d91 nix(refactor): Move withPostgresqlVersions and withAllVersions to new withTools 2021-04-18 13:51:39 +02:00
Wolfgang WaltherandWolfgang Walther dccce946e3 nix(refactor): Move name arguments into scripts and use global postgresql in tests.nix 2021-04-18 13:51:39 +02:00
Wolfgang WaltherandWolfgang Walther 1f206a560b ci: check sha512 of downloaded codecov script 2021-04-16 14:10:49 +02:00
Wolfgang WaltherandWolfgang Walther 42f8f4fdcb ci: remove stack-test-memory 2021-04-16 14:10:49 +02:00
Wolfgang WaltherandWolfgang Walther c67cd5e6fc ci: reorder tests in nix-test to improve performance and give early coverage feedback 2021-04-16 14:10:49 +02:00
Wolfgang WaltherandWolfgang Walther 67e3886547 ci: split nix-build-test into nix-build nix-test and introduce circleci contexts 2021-04-16 14:10:49 +02:00
Wolfgang WaltherandWolfgang Walther cd09cc6c52 ci: fix cirrus build timeout 2021-04-14 00:13:08 +02:00
Wolfgang WaltherandWolfgang Walther d40d704043 remove unused static assets 2021-04-12 20:31:32 +02:00
Wolfgang WaltherandWolfgang Walther 91d0c732f0 add comment to Setup.hs 2021-04-12 20:31:32 +02:00
Wolfgang WaltherandWolfgang Walther 67ca814d0b nix: properly throw away tix files for postgrest-watch, resolves #1807 2021-04-12 19:03:16 +02:00
Wolfgang WaltherandWolfgang Walther fc791a6320 nix: add withTmpDir to checked-shell-script 2021-04-12 19:03:16 +02:00
579a626de2 nix: move withtmpdb to separate file
Co-authored-by: Remo Rechkemmer <59358383+monacoremo@users.noreply.github.com>
2021-04-12 19:03:16 +02:00
Wolfgang WaltherandWolfgang Walther 9118a4a780 fix random codecov/project drops in CI, resolves #1800
Those are caused by running the spec tests with `-threaded`, which results in a race to write to spec.tix.
2021-04-10 20:38:51 +02:00
Wolfgang WaltherandWolfgang Walther 376beac22f update contributing guidelines 2021-04-06 17:07:14 +02:00
Wolfgang WaltherandWolfgang Walther ba86b479f8 cov: refactor ApiRequest profile header detection 2021-01-14 16:40:29 +01:00
Wolfgang WaltherandWolfgang Walther 6dd126461e cov: Remove unused code 2021-01-14 16:40:29 +01:00
Wolfgang WaltherandWolfgang Walther 97d8456382 cov: Add io tests for basic cli commands and invalid config options
Full code coverage for Config.hs except expected overlays.
2021-01-14 16:40:29 +01:00
Wolfgang WaltherandRemo Rechkemmer ab6f90aa78 nix: Add postgrest-with-* tools to run with temporary databases of different versions 2021-01-04 23:14:44 +01:00
Wolfgang WaltherandWolfgang Walther 522308217a refactor: Combine relConstraint and relJunction in relLink 2021-01-03 17:54:28 +01:00
Wolfgang WaltherandWolfgang Walther d173b7d8d6 cov: remove unused fields from type Column 2021-01-03 17:54:28 +01:00
Wolfgang WaltherandWolfgang Walther b8e6450af1 refactor: simplify addXRels 2021-01-03 17:54:28 +01:00
Wolfgang WaltherandWolfgang Walther 45ebaf0ad8 cov: Add comment on SCHEMA in test fixtures 2021-01-03 17:54:28 +01:00
Wolfgang WaltherandWolfgang Walther 1edbef0538 Add STABLE RPCs in test fixtures to increase coverage 2021-01-03 17:54:28 +01:00
Wolfgang WaltherandWolfgang Walther 6efa304142 refactor: Move parseArg to SQL 2021-01-03 17:54:28 +01:00
Wolfgang WaltherandWolfgang Walther eed6015e70 refactor: Move addHasVariadic to SQL 2021-01-03 17:54:28 +01:00
Wolfgang WaltherandWolfgang Walther 94b516d074 Add flag to postgrest.cabal to disable collecting coverage data 2021-01-02 13:51:00 +01:00
Wolfgang WaltherandWolfgang Walther 56a7bc5030 nix: Fix build errors with stale .tix files present 2021-01-02 13:51:00 +01:00
Wolfgang WaltherandWolfgang Walther af2788468e Add basic error handling to --dump-schema 2021-01-02 13:50:19 +01:00
Wolfgang Walther cc54135bf0 Rename master branch to main; replace whiteList with isAllowed 2020-12-31 14:37:52 +01:00
Wolfgang WaltherandRemo Rechkemmer 93541035f6 Fix postgrest-coverage throwing error when installed with nix-env 2020-12-30 16:38:13 +01:00
Wolfgang WaltherandRemo Rechkemmer 568477b6af Fix io tests not collecting coverage data when using run()
Before, postgrest was killed after each test and no coverage data was saved.
Now the process is terminated gracefully via SIGTERM first to allow writing the .tix file.
2020-12-30 14:51:58 +01:00
Wolfgang WaltherandWolfgang Walther 8e02551956 Fix "unused-imports" warning for windows build 2020-12-29 16:07:07 +01:00
Wolfgang WaltherandWolfgang Walther b5185de706 nix: add "cd $rootdir" to all shell scripts via checked-shell-script 2020-12-24 14:44:01 +01:00
Wolfgang WaltherandWolfgang Walther 56557c9c40 ci: remove broken travis coverage job 2020-12-23 19:39:40 +01:00
Wolfgang WaltherandWolfgang Walther 2cbe1ba903 feat: Add --example cli option to show example config file 2020-12-23 19:39:40 +01:00
Wolfgang WaltherandWolfgang Walther 69b459e7b6 Use environment variables for configuration in developer tooling
Avoid the need for configuration files for temporary database connections.
2020-12-23 19:39:40 +01:00
Wolfgang WaltherandWolfgang Walther add326a79d ci: skip postgrest-release-dockerhubdescription for nightly builds 2020-12-23 19:39:40 +01:00
Wolfgang WaltherandWolfgang Walther b7fc393e49 feat: Read config directly from environment variables
resolves #1624
2020-12-23 19:39:40 +01:00
Wolfgang WaltherandWolfgang Walther dbe3c163bd run spec tests in parallel
reduces time to run postgrest-test-spec-all by 20-25%
2020-12-14 00:42:03 +01:00
Wolfgang WaltherandWolfgang Walther 0c25f12825 fix: fix output of RPCs returning scalar values with multiple rows
resolves #1584

BREAKING CHANGE:
Changed output of RPCs to match return type better:
* single scalar return: value (unchanged)
* setof scalar return: array of values (new; was array of objects)
* single composite return: object (new; was array of objects)
* setof composite return: array of objects (unchanged)
* void return: nothing (new; was "null")

A single OUT column is now treated as "composite" instead of "scalar",
i.e. consistent with multiple OUT columns.
2020-12-10 19:55:42 +01:00
Wolfgang WaltherandWolfgang Walther 9254f119f6 fix: implement robust parsing of boolean config values
resolves #1572
2020-12-06 21:59:32 +01:00
Wolfgang WaltherandWolfgang Walther ed58511de3 feat: renamed config options with prefixes; added aliases for old names
* secret-is-base64 -> jwt-secret-is-base64
* role-claim-key -> jwt-role-claim-key
* max-rows -> db-max-rows
* pre-request -> db-pre-request
* root-spec -> db-root-spec
* db-schema -> db-schemas

This is not a breaking change, because aliases are added as well.

refactor: sorted all config keys alphabetically where applicable
2020-12-06 21:59:03 +01:00
Wolfgang Walther ab3375998d ci: fix cirrus low memory error 2020-12-06 20:49:48 +01:00
Wolfgang WaltherandWolfgang Walther 8979442e27 dev: add colors to io tests 2020-12-06 13:33:25 +01:00
Wolfgang WaltherandWolfgang Walther eb46cf2662 added: cli option --dump-config prints loaded config and exits
This is most useful for automated tests for upcoming configuration
features. Can also be used for debugging.
2020-12-06 13:33:25 +01:00
Wolfgang WaltherandWolfgang Walther d218a9eaff dev: improve postgrest-watch experience
* speed up io tests
* avoid infinite loop while watching io tests
* improve auto-complete with postgrest-watch postgrest-run
* detect when files are added or deleted
2020-12-05 16:47:50 +01:00
Wolfgang WaltherandWolfgang Walther 7d6d015822 improve error output for io-tests and with_tmp_db 2020-12-03 22:32:07 +01:00
Wolfgang WaltherandWolfgang Walther de5742fc7d Make nix the one and only dev environment; remove obsolete tooling 2020-12-01 00:42:21 +01:00
Wolfgang WaltherandWolfgang Walther 1a5f6cce46 Add docker files to run nix dev environment on Windows 2020-12-01 00:42:21 +01:00
Wolfgang WaltherandWolfgang Walther b13e95aefb Refactor tx-... config options to single tx-end option 2020-11-23 22:43:49 +01:00
Wolfgang WaltherandWolfgang Walther 3425352035 Clean up postgrest --help output 2020-11-23 17:40:04 +01:00
Wolfgang WaltherandSteve Chavez dbf99c6ac1 Add support for Prefer tx=rollback 2020-11-22 18:21:06 -05:00
Wolfgang WaltherandSteve Chavez 698fac8ff2 Add test to ignore functions unnamed arguments for rpc disambiguation, resolves #1638 2020-11-22 14:48:48 -05:00
Wolfgang WaltherandSteve Chavez 944efb3a6a Split StructureSpec into OpenApiSpec and OptionsSpec 2020-11-20 11:51:49 -05:00
Wolfgang WaltherandSteve Chavez d91f47e582 Remove executable bit on .nix and .sql file 2020-11-20 10:48:47 -05:00
Wolfgang WaltherandSteve Chavez 2c52b96e04 Refactor tests: replace str with json QuasiQuoter where appropriate 2020-11-20 09:24:32 -05:00
Wolfgang WaltherandSteve Chavez e08bb3a197 Fix overloading of functions with unnamed arguments (specifically for prefer params=single-object) 2020-11-20 09:24:32 -05:00
Wolfgang WaltherandSteve Chavez b091586394 Refactor tests: renaming json table to prevent hiding of native json type 2020-11-20 09:24:32 -05:00
Wolfgang WaltherandSteve Chavez ca7ffd0a70 Fix RPC return type handling for domains with composite base type 2020-11-20 09:24:32 -05:00
Wolfgang WaltherandSteve Chavez 122fea1507 Add test to insert into a view and expect location header return 2020-11-03 10:43:06 -05:00
Wolfgang WaltherandSteve Chavez a7403fecc2 refactor: split InsertSpec into InsertSpec and UpdateSpec 2020-11-03 10:43:06 -05:00
Wolfgang WaltherandSteve Chavez efc725fb24 run stylish-haskell v0.12.1.0 2020-11-02 13:22:01 -05:00
Wolfgang WaltherandSteve Chavez 4b4a622a17 fix non-variadic repeated param in variadic function 2020-10-30 10:06:53 -05:00
Wolfgang WaltherandSteve Chavez 302d4e15ad Allow calling variadic functions with repeated query params or JSON array in body 2020-10-26 17:49:51 -05:00
Wolfgang WaltherandSteve Chavez 18cc214c04 refactor moving findProc into ApiRequest to allow parsing parameters differently by proc 2020-10-26 17:49:51 -05:00
Wolfgang WaltherandSteve Chavez 06e85357c7 add tests to pass regular arrays properly to RPCs 2020-10-26 17:49:51 -05:00
Wolfgang WaltherandSteve Chavez eed0d3a66c ci: add coveralls.io integration 2020-10-22 12:05:25 -05:00
Wolfgang WaltherandSteve Chavez 5f33f01094 correct issue numbers in changelog 2020-10-16 10:24:41 -05:00
Wolfgang WaltherandSteve Chavez 719c4abba2 Drop support for postgres 9.4 2020-10-15 08:43:28 -05:00
Wolfgang WaltherandSteve Chavez 29858b8d0d improve cirrus build time by properly using cabal cache 2020-10-14 22:25:42 -05:00
Wolfgang WaltherandSteve Chavez b21a0f6192 fix travis build timeout swallowing error code 2020-10-14 10:49:47 -05:00
Wolfgang WaltherandSteve Chavez f5331d1a77 fix build error on windows 2020-10-14 09:26:35 -05:00
Wolfgang WaltherandSteve Chavez 5bb670b736 fix appveyour build script 2020-10-14 09:26:35 -05:00
Wolfgang WaltherandSteve Chavez d395bb6052 Fix error messages on connection failure for postgres on localized Windows 2020-10-03 10:11:41 -05:00