b3a7f98e5a
CI / E2E Cloudflare (4/8) (push) Failing after 0s
CI / E2E Cloudflare (8/8) (push) Failing after 1s
CI / Lint (push) Failing after 1s
Auto Extract / Extract (push) Failing after 4s
CI / Version Check (push) Failing after 9s
CI / Integration Tests (push) Failing after 1s
CI / E2E tests (1/8) (push) Failing after 1s
CI / E2E tests (2/8) (push) Failing after 2s
CI / E2E tests (3/8) (push) Failing after 2s
CI / Browser Tests (push) Failing after 1s
CI / E2E tests (5/8) (push) Failing after 1s
CI / E2E Cloudflare (2/8) (push) Failing after 2s
CI / Typecheck (push) Failing after 1s
CI / Changeset Validation (push) Failing after 2s
CI / E2E Cloudflare (5/8) (push) Failing after 1s
CI / E2E Cloudflare (6/8) (push) Failing after 1s
CI / E2E Cloudflare (7/8) (push) Failing after 1s
CodeQL / Analyze (javascript-typescript) (push) Failing after 1s
Format / Format (push) Failing after 0s
CodeQL / Analyze (actions) (push) Failing after 4s
CI / E2E tests (4/8) (push) Failing after 1s
CI / E2E tests (6/8) (push) Failing after 1s
CI / E2E tests (7/8) (push) Failing after 2s
CI / E2E tests (8/8) (push) Failing after 1s
CI / E2E Cloudflare (1/8) (push) Failing after 1s
CI / E2E Cloudflare (3/8) (push) Failing after 2s
Preview Releases / Publish Preview (push) Failing after 0s
zizmor / Run zizmor (push) Failing after 1s
Release / Release (push) Failing after 2s
CI / Smoke Tests (push) Failing after 5m36s
CI / Tests (push) Failing after 6m36s
Release / Sync Templates (push) Has been skipped
CI / E2E Tests (push) Has been cancelled
42 lines
1.2 KiB
Bash
Executable File
42 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# Reset remote D1 database by deleting and recreating it.
|
|
# With Access auth + autoProvision, users are recreated on first login.
|
|
#
|
|
# Usage: pnpm db:reset:remote
|
|
|
|
set -euo pipefail
|
|
|
|
DB_NAME="emdash-demo"
|
|
WRANGLER_CONFIG="wrangler.jsonc"
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
cd "$SCRIPT_DIR/.."
|
|
|
|
echo "Deleting database '$DB_NAME'..."
|
|
npx wrangler d1 delete "$DB_NAME" --skip-confirmation
|
|
|
|
echo "Creating new database '$DB_NAME'..."
|
|
OUTPUT=$(npx wrangler d1 create "$DB_NAME" 2>&1)
|
|
echo "$OUTPUT"
|
|
|
|
# Extract new database ID from output
|
|
NEW_ID=$(echo "$OUTPUT" | grep -o '"database_id": "[^"]*"' | head -1 | cut -d'"' -f4)
|
|
|
|
if [ -z "$NEW_ID" ]; then
|
|
echo "Failed to extract new database ID"
|
|
exit 1
|
|
fi
|
|
|
|
echo "New database ID: $NEW_ID"
|
|
|
|
# Update wrangler.jsonc with new ID
|
|
if [ -f "$WRANGLER_CONFIG" ]; then
|
|
echo "Updating $WRANGLER_CONFIG with new database ID..."
|
|
sed -i '' "s/\"database_id\": \"[^\"]*\"/\"database_id\": \"$NEW_ID\"/" "$WRANGLER_CONFIG"
|
|
fi
|
|
|
|
echo ""
|
|
echo "Database recreated. Next steps:"
|
|
echo " 1. pnpm deploy (redeploy with new DB ID)"
|
|
echo " 2. Visit /_emdash/admin to run setup wizard (applies seed content)"
|
|
echo " 3. Access will auto-provision your admin user on first login"
|