From 1c36439bed845024b8243bc9a2a6150a0d96671f Mon Sep 17 00:00:00 2001 From: qaz741wsd856 Date: Sat, 29 Nov 2025 07:45:10 +0000 Subject: [PATCH] chore: hide database name in action and update readme --- .github/workflows/backup-d1.yaml | 4 ++-- README.md | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/.github/workflows/backup-d1.yaml b/.github/workflows/backup-d1.yaml index 5594b43..9e64adb 100644 --- a/.github/workflows/backup-d1.yaml +++ b/.github/workflows/backup-d1.yaml @@ -43,7 +43,7 @@ jobs: echo "❌ Error: Could not find database with D1_DATABASE_ID secret" exit 1 fi - echo "Found database name: $DB_NAME" + echo "Found database name echo "db_name=$DB_NAME" >> $GITHUB_OUTPUT - name: Export D1 Database @@ -158,7 +158,7 @@ jobs: echo "❌ Error: Could not find database with D1_DATABASE_ID_DEV secret exit 1 fi - echo "Found database name: $DB_NAME" + echo "Found database name echo "db_name=$DB_NAME" >> $GITHUB_OUTPUT - name: Export D1 Database (Dev) diff --git a/README.md b/README.md index bb922a0..dbd0e4d 100644 --- a/README.md +++ b/README.md @@ -245,6 +245,31 @@ To restore your D1 database from a backup: > **Note:** The `--remote` flag is required to execute against your production D1 database. Without it, the command will run against the local development database. +#### D1 Time Travel (Point-in-Time Recovery) + +Cloudflare D1 provides a built-in Time Travel feature that allows you to restore your database to any point within the last 30 days. This is useful for undoing accidental data modifications or deletions without needing a backup. + +To use Time Travel: + +1. **Check current restore bookmark:** + + ```bash + # Replace DATABASE_NAME with your actual database name (e.g., warden-db) + wrangler d1 time-travel info DATABASE_NAME + ``` + +2. **Restore to a specific timestamp:** + + ```bash + # Restore to a specific point in time (ISO 8601 format) + wrangler d1 time-travel restore DATABASE_NAME --timestamp=2024-01-15T12:00:00Z + + # Or restore to a specific bookmark + wrangler d1 time-travel restore DATABASE_NAME --bookmark= + ``` + +> **Note:** Time Travel retains data for 30 days on the free tier. See [Cloudflare D1 Time Travel documentation](https://developers.cloudflare.com/d1/reference/time-travel/) for more details. + ### Local Development with D1 You can run this Worker locally with full D1 database support using Wrangler. This is useful for development, testing, or as a temporary fallback when Cloudflare services are unavailable.