mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-24 07:52:14 +03:00
63594e1828
GitOrigin-RevId: 23efdf4d3b3902b5ce7ec14061faa53b18258e86
41 lines
769 B
YAML
41 lines
769 B
YAML
type: bulk
|
|
args:
|
|
|
|
- type: run_sql
|
|
args:
|
|
sql: |
|
|
CREATE TABLE profile (
|
|
id TEXT,
|
|
name TEXT
|
|
);
|
|
|
|
INSERT INTO profile (id, name) VALUES ('10', 'Miles'), ('42', 'Charlie');
|
|
|
|
CREATE FUNCTION me(hasura_session json)
|
|
RETURNS SETOF profile AS $$
|
|
SELECT * FROM profile
|
|
WHERE id = hasura_session ->> 'x-hasura-user-id'
|
|
$$ LANGUAGE sql STABLE;
|
|
|
|
- type: track_table
|
|
args:
|
|
schema: public
|
|
name: profile
|
|
|
|
- type: create_select_permission
|
|
args:
|
|
table: profile
|
|
role: user
|
|
permission:
|
|
columns: [id, name]
|
|
filter: {}
|
|
|
|
- type: track_function
|
|
version: 2
|
|
args:
|
|
function:
|
|
name: me
|
|
schema: public
|
|
configuration:
|
|
session_argument: hasura_session
|