Repository navigation
docs: add a point in time recovery page for Prisma Postgres #9014
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2b13de2
docs: add a point in time recovery page for Prisma Postgres
tylerhogarth b4a19b8
docs(postgres): name PITR, plans and restore windows up front on the …
gregory-boch-prisma 53d4404
docs(postgres): cover every plan in the point-in-time recovery table
gregory-boch-prisma 62d794e
Merge remote-tracking branch 'origin/main' into docs/point-in-time-re…
gregory-boch-prisma e3d8929
docs: Vercel-workspace cleanup, PITR MCP tools and the tutorial backu…
gregory-boch-prisma 13de90f
site, docs: list the PITR MCP tools on the MCP server card
gregory-boch-prisma File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
apps/docs/content/docs/postgres/database/point-in-time-recovery.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| --- | ||
| title: Point-in-time recovery (PITR) | ||
| description: "Point-in-time recovery (PITR) for Prisma Postgres: restore to a timestamp in the last 7 days on Pro or 30 days on Business and Enterprise, into a new database." | ||
| metaTitle: "Point-in-time recovery (PITR) for Prisma Postgres: 7 or 30 days" | ||
| metaDescription: Prisma Postgres point-in-time recovery (PITR) restores a database to any timestamp in the last 7 days (Pro) or 30 days (Business, Enterprise), into a new database. Not on Free or Starter. Console, REST API and MCP. | ||
| url: /postgres/database/point-in-time-recovery | ||
| --- | ||
|
|
||
| Prisma Postgres supports point-in-time recovery (PITR) on Pro (7 days) and on Business and Enterprise (30 days). It is not available on Free or Starter. | ||
|
|
||
| Point-in-time recovery (PITR) restores a Prisma Postgres database to a timestamp you choose, into a new database. Use it to get back rows that were deleted or changed by mistake. Unlike a [backup](/postgres/database/backups), it is not limited to the times of daily snapshots. | ||
|
|
||
| For example, if a migration deleted a column at 14:05, restore the database as it was at 14:04. Then copy the data you need back into the original database. | ||
|
|
||
| The restore always creates a new database. The original database is not changed, and your app keeps using it while the restore runs. | ||
|
|
||
| ## Which plans have PITR, and how far back can you restore | ||
|
|
||
| Point-in-time recovery is available on the Pro, Business, and Enterprise plans. On those plans, the restore window is how far back you can go. Free and Starter do not have point-in-time recovery: | ||
|
|
||
| | Plan | Point-in-time recovery | What you can restore | | ||
| | ---------- | ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | Free | No | Nothing. The Free plan has no backups. | | ||
| | Starter | No | A [daily backup](/postgres/database/backups), kept 7 days and taken on days the database has activity. You restore to a daily snapshot, not to a time you choose. | | ||
| | Pro | Yes | Any time in the last 7 days, from your earliest retained backup | | ||
| | Business | Yes | Any time in the last 30 days, from your earliest retained backup | | ||
| | Enterprise | Yes | Any time in the last 30 days, from your earliest retained backup | | ||
|
|
||
| On Pro, Business, and Enterprise, the newest time you can choose is 10 minutes ago. The oldest time is your earliest retained backup, so it can be later than the start of the window: | ||
|
|
||
| - A new database can be restored only after its first backup has finished. | ||
| - After you [restore a backup](/postgres/database/backups#restoring-a-backup) in place, you can only restore to times after the next backup that finishes. | ||
| - Some older databases do not support point-in-time recovery. Console says so on the database's **Point in time** page. | ||
|
|
||
| ## Restore to a point in time in Console | ||
|
|
||
| To restore a database, you need the Admin role, or the Developer role with access to the project. See [Workspace roles and project access](/console/workspace-access). | ||
|
|
||
| 1. Open the database in the [Prisma Console](https://console.prisma.io) and select **Point in time** in the sidebar. | ||
| 2. Under **Choose Point in Time**, choose the date and time to restore to. The description under the label shows the oldest and newest times you can choose. | ||
| 3. Optional: choose a different time zone in the list next to the date. Times are shown in your local time zone by default. The time zone changes only how the times are shown. | ||
| 4. Under **Choose Database Name**, enter a name for the new database. | ||
| 5. Click **Restore to new database**. | ||
|
|
||
| Console opens the new database's **Dashboard**, which shows that the database is being restored. | ||
|
|
||
| The new database is created in the same project, on the same branch, and in the same region as the original. It counts toward the database limit of your plan. | ||
|
|
||
| ## While the restore runs | ||
|
|
||
| A restore can take several hours for a large database. While it runs: | ||
|
|
||
| - The new database's **Dashboard** shows the progress, and updates when the restore finishes. You can leave the page and come back later. | ||
| - The sidebar shows only **Dashboard** and **Settings** for the new database. You cannot open Studio, Queries, or connection strings until the restore finishes. | ||
| - On **Settings**, you cannot rename the database. For the first few minutes, you cannot delete it either. Console shows **This restore is still starting** until the delete is possible. | ||
|
|
||
| When the restore finishes, Prisma sends an email to the Admins and Developers who can access the project. If the restore fails, the email says so and links to the **Point in time** page, where you can try again. A failed restore can leave the new database incomplete. Open it from the email to keep or delete it. A restore that has not finished after 24 hours is marked as failed. | ||
|
|
||
| ## Use the restored data | ||
|
|
||
| The new database has its own connection strings. The connection strings of the original database do not reach it. | ||
|
|
||
| 1. [Generate a connection string](/postgres/database/connecting-to-your-database#get-your-connection-strings) for the new database. | ||
| 2. Copy the rows you need back into the original database, or point your app at the new database. | ||
|
|
||
| [Recover deleted records from a hosted Postgres database](https://www.prisma.io/postgres/recover-deleted-records) walks through copying rows back. | ||
|
|
||
| When you no longer need the new database, delete it from its **Settings** page. If the database is on a branch that [Delete Protection](/console/delete-protection) covers, turn off **Data** first. In a workspace created through the Vercel integration, the Console can't delete it: use the Prisma CLI or the REST API, as described in [Deleting a restored copy in a Vercel workspace](/postgres/database/backups#deleting-a-restored-copy-in-a-vercel-workspace). | ||
|
|
||
| ## Restore with the REST API or MCP tools | ||
|
|
||
| The REST API and [MCP tools](/ai/mcp-tools) use the same restore window as Console. | ||
|
|
||
| **REST API** | ||
|
|
||
| 1. Call [`GET /v1/databases/{databaseId}/backups/pitr`](/rest-api/endpoints/database-backups/get-databases-by-database-id-backups-pitr) to read the oldest and newest times you can restore to. `window` is `null` when no time is available, and `meta.availableOnPlan` is `false` when your plan does not include point-in-time recovery. | ||
| 2. Call [`POST /v1/projects/{projectId}/databases`](/rest-api/endpoints/databases/post-projects-by-project-id-databases) with a `source` of type `pitr`: | ||
|
|
||
| ```json | ||
| { | ||
| "name": "orders-restored", | ||
| "source": { | ||
| "type": "pitr", | ||
| "databaseId": "db_123", | ||
| "targetTime": "2026-12-01T14:04:00Z" | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| `targetTime` is an ISO 8601 date and time inside the window. | ||
|
|
||
| **MCP tools** | ||
|
|
||
| - `get_prisma_postgres_pitr_window` returns the window of a database. | ||
| - `create_prisma_postgres_recovery` with a `targetTime` restores the database to a new database. | ||
|
|
||
| ## Next steps | ||
|
|
||
| - [Backups](/postgres/database/backups): restore a daily snapshot, or restore a database in place. | ||
| - [Connecting to your database](/postgres/database/connecting-to-your-database): get connection strings for the restored database. | ||
| - [Delete Protection](/console/delete-protection): stop the original database from being deleted by mistake. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.