chore: hide database name in action and update readme
This commit is contained in:
parent
00f714e60d
commit
1c36439bed
2 changed files with 27 additions and 2 deletions
4
.github/workflows/backup-d1.yaml
vendored
4
.github/workflows/backup-d1.yaml
vendored
|
|
@ -43,7 +43,7 @@ jobs:
|
||||||
echo "❌ Error: Could not find database with D1_DATABASE_ID secret"
|
echo "❌ Error: Could not find database with D1_DATABASE_ID secret"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "Found database name: $DB_NAME"
|
echo "Found database name
|
||||||
echo "db_name=$DB_NAME" >> $GITHUB_OUTPUT
|
echo "db_name=$DB_NAME" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Export D1 Database
|
- name: Export D1 Database
|
||||||
|
|
@ -158,7 +158,7 @@ jobs:
|
||||||
echo "❌ Error: Could not find database with D1_DATABASE_ID_DEV secret
|
echo "❌ Error: Could not find database with D1_DATABASE_ID_DEV secret
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "Found database name: $DB_NAME"
|
echo "Found database name
|
||||||
echo "db_name=$DB_NAME" >> $GITHUB_OUTPUT
|
echo "db_name=$DB_NAME" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Export D1 Database (Dev)
|
- name: Export D1 Database (Dev)
|
||||||
|
|
|
||||||
25
README.md
25
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.
|
> **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=<bookmark_id>
|
||||||
|
```
|
||||||
|
|
||||||
|
> **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
|
### 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.
|
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.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue