Chelabase
ManagementData api

Change a Postgres database's default schema

PATCH
/v1/databases/{id}/branches/{branch_id}/pg-databases/{name}

Stores the schema a data API request to this database uses when it names none. On a served database the bootstrap re-runs for the new schema (so default privileges cover it) before the answer, and the data API picks the change up at once. Objects already in the new schema get the data API grants only with grant_existing: true; that flag with an unchanged schema grants on its existing objects now.

Authorization

bearer
AuthorizationBearer <token>

In: header

Path Parameters

id*string

Database id

Formatuuid
branch_id*string

Branch id

Formatuuid
name*string

The Postgres database's name

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

A database's data API settings.

default_schema*string

The schema a request to this database uses when it names none: ^[a-z_][a-z0-9_]{0,62}$.

grant_existing?boolean

Also grant the data API roles on the objects already in the schema (default false). Without it, only objects created from now on get grants (through default privileges), plus, once per database, the first schema's existing objects (a database whose first enable ran while its schema was missing gets that full first grant once the schema exists, flag or not). Grants only: it never revokes anything. Sent with an unchanged default_schema it grants on that schema's existing objects now, and answers 409 data_api_disabled when the database isn't served.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X PATCH "https://example.com/v1/databases/497f6eca-6276-4993-bfeb-53cbbbba6f08/branches/497f6eca-6276-4993-bfeb-53cbbbba6f08/pg-databases/string" \  -H "Content-Type: application/json" \  -d '{    "default_schema": "string"  }'
{  "data_api": "off",  "data_api_error": "string",  "default_schema": "string",  "main": true,  "name": "string",  "origin": "main",  "owner": "string"}