-
Notifications
You must be signed in to change notification settings - Fork 375
Expand file tree
/
Copy pathconfiguration.sql
More file actions
34 lines (27 loc) · 1.15 KB
/
configuration.sql
File metadata and controls
34 lines (27 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
CREATE EXTENSION IF NOT EXISTS postgres_fdw;
CREATE SERVER spicedb_fdw FOREIGN DATA WRAPPER postgres_fdw OPTIONS (host 'host.docker.internal', dbname 'default', port '5433', use_remote_estimate 'true');
CREATE USER MAPPING FOR postgres SERVER spicedb_fdw OPTIONS (user 'postgres', password 'proxypassword');
CREATE SCHEMA spicedb;
-- IMPORT FOREIGN SCHEMA spicedb FROM SERVER spicedb_fdw INTO spicedb;
CREATE FOREIGN TABLE relationships (
resource_type text NOT NULL,
resource_id text NOT NULL,
relation text NOT NULL,
subject_type text NOT NULL,
subject_id text NOT NULL,
optional_subject_relation text default '',
caveat_name text default '',
caveat_context text default '',
consistency text default ''
) SERVER spicedb_fdw;
CREATE FOREIGN TABLE permissions (
resource_type text NOT NULL,
resource_id text NOT NULL,
permission text NOT NULL,
subject_type text NOT NULL,
subject_id text NOT NULL,
optional_subject_relation text NOT NULL,
has_permission boolean, -- NULL when maybe
consistency text default ''
) SERVER spicedb_fdw;
CREATE FOREIGN TABLE schema ( schema_text text ) SERVER spicedb_fdw;