You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: cli/postgres/README.md
+83-1Lines changed: 83 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -106,22 +106,103 @@ default_schema = "public"
106
106
# maps to a Postgres database name in your gateway configuration.
107
107
# Defaults to "default" if you don't specify it
108
108
database_name = "default"
109
+
110
+
# Enable mutations (write operations) globally for the whole database.
111
+
# Defaults to true if you omit this setting.
112
+
enable_mutations = true
113
+
114
+
# Enable queries (read operations) globally for the whole database.
115
+
# Defaults to true if you omit this setting.
116
+
enable_queries = true
117
+
118
+
# Configure schemas for this database. Key-value from schema name to configuration.
119
+
schemas = {}
120
+
```
121
+
122
+
### Schema Configuration
123
+
124
+
```toml
125
+
[schemas.public]
126
+
127
+
# Enable mutations (write operations) globally for the whole schema.
128
+
# Takes precedence over the global setting. Defaults to true if you omit this setting.
129
+
enable_mutations = true
130
+
131
+
# Enable queries (read operations) globally for the whole database.
132
+
# Takes precedence over the global setting. Defaults to true if you omit this setting.
133
+
enable_queries = true
134
+
135
+
# Configure views for this schema.
136
+
views = {}
137
+
138
+
# Configure tables for this schema. Key-value from table name to configuration.
139
+
tables = {}
109
140
```
110
141
111
-
### Exposing Views
142
+
### Table Configuration
143
+
144
+
```toml
145
+
[schemas.public.tables.users]
146
+
147
+
# Enable mutations (write operations) for the table.
148
+
# Takes precedence over the global and schema settings.
149
+
# Defaults to true if you omit this setting.
150
+
enable_mutations = true
151
+
152
+
# Enable queries (read operations) for the table.
153
+
# Takes precedence over the global and schema settings.
154
+
# Defaults to true if you omit this setting.
155
+
enable_queries = true
156
+
157
+
# Table relations are always calculated from the database foreign keys.
158
+
# In cases like with table to view relations this is not possible, and
159
+
# you can define them manually from this map. Key/value from relation name
160
+
# to config.
161
+
relations = {}
162
+
```
163
+
164
+
### View Configuration
112
165
113
166
PostgreSQL views require additional configuration because the information schema doesn't provide details about unique constraints, nullability, or relations. To make a view visible in your GraphQL SDL, you must define at least one unique key.
114
167
168
+
```toml
169
+
[schemas.public.views.restricted_users]
170
+
171
+
# Enable queries (read operations) for the the view.
172
+
# Takes precedence over the global and schema settings.
173
+
# Defaults to true if you omit this setting.
174
+
enable_queries = true
175
+
176
+
# Even if the underlying table has unique constraints, the database does not
177
+
# show them for the view presenting the data. Single column keys you can configure
178
+
# better through the columns map, but use this for compound keys.
179
+
# An array of arrays. Each array is a collection of columns forming the key. Order
180
+
# of the columns matter.
181
+
unique_keys = []
182
+
183
+
# The database does not have information on the nullability, or uniqueness
184
+
# of view columns. You can define column settings manually from this map.
185
+
# Key/value from column name to config.
186
+
columns = {}
187
+
188
+
# Views do not have foreign keys mapped to them, as tables do. You
189
+
# can define relations manualy from this map.
190
+
# Key/value from relation name to config.
191
+
relations = {}
192
+
```
193
+
115
194
#### Unique Key Definitions
116
195
117
196
```toml
118
197
[schemas.public.views.my_view]
198
+
119
199
# The order of columns matters - match the order in the underlying query/table.
0 commit comments