Skip to content

Commit 933b734

Browse files
committed
Merge branch 'master' into issue-1182-cache-update
Resolve Conflicts: server/src-exec/Main.hs server/src-exec/Ops.hs server/src-lib/Hasura/Server/App.hs server/src-lib/Hasura/Server/Init.hs server/src-lib/Hasura/Server/Query.hs server/src-rsr/migrate_from_9_to_10.sql
2 parents 2c4fa62 + c357539 commit 933b734

File tree

322 files changed

+7820
-5325
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

322 files changed

+7820
-5325
lines changed

.circleci/config.yml

+27
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,28 @@ jobs:
336336
paths:
337337
- _console_output
338338

339+
# test server upgrade from last version to current build
340+
test_server_upgrade:
341+
docker:
342+
- image: hasura/graphql-engine-upgrade-tester:v0.4
343+
environment:
344+
HASURA_GRAPHQL_DATABASE_URL: postgres://gql_test:@localhost:5432/gql_test
345+
- image: circleci/postgres:10-alpine
346+
environment:
347+
POSTGRES_USER: gql_test
348+
POSTGRES_DB: gql_test
349+
working_directory: ~/graphql-engine
350+
steps:
351+
- checkout
352+
- attach_workspace:
353+
at: /build
354+
- run:
355+
name: upgrade_test
356+
command: .circleci/server-upgrade/run.sh
357+
- store_artifacts:
358+
path: /build/_server_output
359+
destination: server
360+
339361
deploy:
340362
docker:
341363
- image: hasura/graphql-engine-deployer:v0.3
@@ -374,13 +396,18 @@ workflows:
374396
<<: *filter_only_vtags
375397
requires:
376398
- build_server
399+
- test_server_upgrade:
400+
<<: *filter_only_vtags
401+
requires:
402+
- build_server
377403
- all_server_tests_pass:
378404
<<: *filter_only_vtags
379405
requires:
380406
- pytest_server_pg_11.1
381407
- pytest_server_pg_10.6
382408
- pytest_server_pg_9.6
383409
- pytest_server_pg_9.5
410+
- test_server_upgrade
384411
- test_cli_with_last_release:
385412
<<: *filter_only_vtags
386413
- test_and_build_cli:

.circleci/server-upgrade/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
_output
2+
node_modules
3+
yarn.lock

.circleci/server-upgrade/Dockerfile

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM node:11-slim
2+
3+
RUN apt-get update && apt-get install -y \
4+
libpq5 \
5+
netcat \
6+
&& curl -L https://github.com/hasura/graphql-engine/raw/master/cli/get.sh | INSTALL_PATH=/bin bash
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const echo = (req, res) => {
2+
try {
3+
const { event: { op, data }, table: { name, schema } } = req.body;
4+
const response = { message: 'received event', data: { op, data, name, schema } };
5+
console.log('--->', response);
6+
return res.json(response);
7+
} catch (err) {
8+
console.error('xxx>', err);
9+
return res.status(500).json({ error: err.message || err });
10+
}
11+
};
12+
13+
export default echo;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { buildSchema } from 'graphql';
2+
3+
const schema = buildSchema(`
4+
type Query {
5+
hello: String
6+
}
7+
`);
8+
9+
const root = {
10+
hello: () => {
11+
return 'Hello world!';
12+
}
13+
};
14+
15+
export { schema, root };
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import express from 'express';
2+
import morgan from 'morgan';
3+
import graphqlHTTP from 'express-graphql';
4+
5+
import echo from './echo';
6+
import { schema, root } from './graphql';
7+
8+
const app = express();
9+
app.use(express.json());
10+
app.use(morgan('tiny'));
11+
12+
app.get('/', (req, res) => res.send('api server listening for requests'));
13+
14+
app.post('/trigger/echo', echo);
15+
16+
app.use('/remote-schema/hello', graphqlHTTP({
17+
schema: schema,
18+
rootValue: root,
19+
graphiql: process.env.ENABLE_GRAPHIQL === 'true' ? true : false,
20+
}));
21+
22+
const port = process.env.PORT || 3000;
23+
app.listen(port, () => console.log(`event triggers listening on port ${port}!`));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "api-server",
3+
"version": "1.0.0",
4+
"description": "api server for event triggers and remote schemas",
5+
"main": "index.js",
6+
"author": "shahidhk",
7+
"license": "MIT",
8+
"scripts": {
9+
"test": "echo \"Error: no test specified\" && exit 1",
10+
"start": "nodemon -r esm index.js",
11+
"start-prod": "node -r esm index.js"
12+
},
13+
"devDependencies": {
14+
"nodemon": "^1.18.10"
15+
},
16+
"dependencies": {
17+
"esm": "^3.2.6",
18+
"express": "^4.16.4",
19+
"express-graphql": "^0.7.1",
20+
"graphql": "^14.1.1",
21+
"morgan": "^1.9.1"
22+
}
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
endpoint: http://localhost:8080
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- args:
2+
sql: DROP TABLE "public"."author"
3+
type: run_sql
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
- args:
2+
sql: CREATE TABLE "public"."author"("id" serial NOT NULL, "name" text NOT NULL,
3+
PRIMARY KEY ("id") );
4+
type: run_sql
5+
- args:
6+
name: author
7+
schema: public
8+
type: add_existing_table_or_view
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- args:
2+
sql: DROP TABLE "public"."article"
3+
type: run_sql
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
- args:
2+
sql: CREATE TABLE "public"."article"("id" serial NOT NULL, "title" text NOT NULL,
3+
"author_id" integer NOT NULL, PRIMARY KEY ("id") );
4+
type: run_sql
5+
- args:
6+
name: article
7+
schema: public
8+
type: add_existing_table_or_view
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- args:
2+
sql: ALTER TABLE "public"."article" DROP CONSTRAINT "article_author_id_fkey"
3+
type: run_sql
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- args:
2+
sql: ALTER TABLE "public"."article" ADD FOREIGN KEY ("author_id") REFERENCES "public"."author"
3+
("id")
4+
type: run_sql
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- args:
2+
relationship: authorByauthorId
3+
table:
4+
name: article
5+
schema: public
6+
type: drop_relationship
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
- args:
2+
name: authorByauthorId
3+
table:
4+
name: article
5+
schema: public
6+
using:
7+
foreign_key_constraint_on: author_id
8+
type: create_object_relationship
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- args:
2+
relationship: articlesByauthorId
3+
table:
4+
name: author
5+
schema: public
6+
type: drop_relationship
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
- args:
2+
name: articlesByauthorId
3+
table:
4+
name: author
5+
schema: public
6+
using:
7+
foreign_key_constraint_on:
8+
column: author_id
9+
table:
10+
name: article
11+
schema: public
12+
type: create_array_relationship
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- args:
2+
role: user
3+
table:
4+
name: author
5+
schema: public
6+
type: drop_insert_permission
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
- args:
2+
permission:
3+
allow_upsert: true
4+
check:
5+
id:
6+
_eq: X-Hasura-User-Id
7+
columns:
8+
- name
9+
set:
10+
id: x-hasura-user-id
11+
role: user
12+
table:
13+
name: author
14+
schema: public
15+
type: create_insert_permission
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- args:
2+
role: user
3+
table:
4+
name: author
5+
schema: public
6+
type: drop_select_permission
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
- args:
2+
permission:
3+
allow_aggregations: true
4+
columns:
5+
- id
6+
- name
7+
filter:
8+
id:
9+
_eq: X-Hasura-User-Id
10+
limit: null
11+
role: user
12+
table:
13+
name: author
14+
schema: public
15+
type: create_select_permission
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- args:
2+
role: user
3+
table:
4+
name: author
5+
schema: public
6+
type: drop_update_permission
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
- args:
2+
permission:
3+
columns:
4+
- name
5+
filter:
6+
id:
7+
_eq: X-Hasura-User-Id
8+
set: {}
9+
role: user
10+
table:
11+
name: author
12+
schema: public
13+
type: create_update_permission
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- args:
2+
role: user
3+
table:
4+
name: author
5+
schema: public
6+
type: drop_delete_permission
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
- args:
2+
permission:
3+
filter:
4+
id:
5+
_eq: X-Hasura-User-Id
6+
role: user
7+
table:
8+
name: author
9+
schema: public
10+
type: create_delete_permission
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- args:
2+
role: user
3+
table:
4+
name: article
5+
schema: public
6+
type: drop_insert_permission
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
- args:
2+
permission:
3+
allow_upsert: true
4+
check:
5+
author_id:
6+
_eq: X-Hasura-User-Id
7+
columns:
8+
- id
9+
- title
10+
set:
11+
author_id: x-hasura-user-id
12+
role: user
13+
table:
14+
name: article
15+
schema: public
16+
type: create_insert_permission
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- args:
2+
role: user
3+
table:
4+
name: article
5+
schema: public
6+
type: drop_select_permission
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
- args:
2+
permission:
3+
allow_aggregations: true
4+
columns:
5+
- author_id
6+
- id
7+
- title
8+
filter:
9+
author_id:
10+
_eq: X-Hasura-User-Id
11+
limit: null
12+
role: user
13+
table:
14+
name: article
15+
schema: public
16+
type: create_select_permission
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- args:
2+
role: user
3+
table:
4+
name: article
5+
schema: public
6+
type: drop_update_permission
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
- args:
2+
permission:
3+
columns:
4+
- title
5+
filter:
6+
author_id:
7+
_eq: X-Hasura-User-Id
8+
set: {}
9+
role: user
10+
table:
11+
name: article
12+
schema: public
13+
type: create_update_permission
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- args:
2+
role: user
3+
table:
4+
name: article
5+
schema: public
6+
type: drop_delete_permission
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
- args:
2+
permission:
3+
filter:
4+
author_id:
5+
_eq: X-Hasura-User-Id
6+
role: user
7+
table:
8+
name: article
9+
schema: public
10+
type: create_delete_permission
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- args:
2+
name: author_echo
3+
type: delete_event_trigger

0 commit comments

Comments
 (0)