Palbase Machines · API
/databases/{name}Change a database
Changes who may connect to the database, how long its backups are kept, and its size. A change of size is answered at once (202), the database as it moves to it; the others with the database as changed (200). Emits database.updated.
Called by your server, with the project's secret key.
Path
namestring · requiredThe database's name: lowercase letters, digits and dashes, starting with a letter and not ending with a dash, 32 at most.Request body
allowstring[] · optionalWho may connect, as addresses or CIDRs (203.0.113.7, 203.0.113.0/24), 50 at most; anyone with the password when empty.backup_daysinteger · optionalHow many days the database's backups are kept: it can be brought back to any moment of them. 1 to 35.sizestring · optionalThe database's size (see `Database.size`); one that is paid for is open to the platform's own project and those named for it alone, as it is opened (403 `size_not_available`). One of the same machine and disk and no larger volume — hobby to free — changes in place. Any other moves through an instance of the new size beside the one that serves, made where the new size lives (a disk of its own, or a SAN volume of its own), which then takes over: the database serves on meanwhile (`state` resizing); its sessions on the direct port end once, when its primary moves, and new logins and transactions wait a few seconds for it. One asleep is woken for its move — its awake hours or disk traffic spent or not, when the size it moves to has no such limit; to one whose it has spent, it sleeps — and the move's time counts against none of them. One down for want of room, moved to a size of a larger volume, is given that room first, in place, and moves once it serves. A move that has not come to its switchover within two hours, and a second for every 10 MB the database holds, is let go: the database stays its size, and `state_reason` says why until its size is changed again — as is one whose primary went down three times before it came to its switchover. One whose primary moves where the move did not ask is stopped, both its instances kept (`state_reason`); onto its instance of the new size, ready — as a node drained moves it — it has come to its switchover. One whose instance of the new size does not take over within five minutes of its switchover says so in `state_reason`, and moves on once it does. Its disk never shrinks, and a database on a disk of its own keeps its storage (`storage_gb`) through the change. While it moves it serves with the connections of the one of the two sizes that takes fewer; the machines given it are rolled out to their share of the new size's — at once when it takes fewer, once it has moved when it takes more. A size smaller than what it holds is refused (409 `database_too_large`), as is one of a smaller quota while what it holds is not measured yet (409 `database_not_measured`, Retry-After), and so is one the project's limit has no room for (409 `machines_over_limit`), or one whose connections are too few for the copies the machines given it run (409 `database_connections_short`).storage_gbinteger (int64) · optionalWhat it holds, grown, in GB: more than it holds, 1 or a multiple of 5, up to 4,000 — never less (409 `storage_shrinks`), and six hours at least after it last grew (409 `storage_grew_recently`, Retry-After) — at once, though, when its organization's owners were told it is 90% full or full at what it holds (`database.storage_warning`, `database.storage_full`). It grows where it is, serving on; it holds the same through a change of size.storage_autoscalingboolean · optionalWhether it grows by itself: 90% full, by half, to the next multiple of 5 GB, six hours at least after it last grew; as it was when left out. Of a size on a disk of its own.curl -X PATCH "https://<your-ref>.palbase.studio/databases/<name>" \
-H "apikey: $PALBASE_SECRET_KEY" \
-H "content-type: application/json" \
-d '{"allow":["string"],"backup_days":1,"size":"dedicated-1x","storage_gb":1,"storage_autoscaling":false}'Responses
200The database, with the change asked for
202The database, moving to its new size
400Validation failed or a required field is missing
401Missing or invalid API key
403Not the project's secret key; or the request requires elevated owner authentication (`owner_only`, `insufficient_user_authentication`).
404The project has no database of this name
409The project already has a database of this name (or one being purged), the environment as many databases as it may, or no room left for this one; a password change is still on its way to the database; or a machine is given the database; or the database is moving to another size, cannot start (a change of its size waits for a restore that brings it back), holds more than the one asked, or would have too few connections for the copies of the machines given it; or, to the console, the database is being brought back to a moment, cannot start, or has run its awake hours for the month
429Over the project's request limit, or its machine time for this period is used up
503Temporarily unavailable; retrying is safe after Retry-After
defaultAn error: the envelope names it (`error`) and explains it (`error_description`).
Operation UpdateDatabase of machines's contract.