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
+82-21Lines changed: 82 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,10 +23,12 @@ cargo install --path .
23
23
24
24
-`DATABASE_URL` - Connection string to your PostgreSQL database
25
25
26
+
If the current directory has a `.env` file stored with the `DATABASE_URL` environment variable, it will be used as the default value for the `--database-url` option.
# The default schema, which we'll omit from the SDL output.
93
+
# Defaults to "public" if you don't specify it
94
+
default_schema = "public"
95
+
96
+
# The name of the database the virtual subgraph should use. This
97
+
# maps to a Postgres database name in your gateway configuration.
98
+
# Defaults to "default" if you don't specify it
99
+
database_name = "default"
95
100
```
96
101
102
+
### Exposing Views
103
+
104
+
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.
105
+
106
+
#### Unique Key Definitions
107
+
108
+
```toml
109
+
[schemas.public.views.my_view]
110
+
# The order of columns matters - match the order in the underlying query/table.
0 commit comments