You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# After running this, you'll need to replace the database_id in wrangler.toml
npx wrangler d1 create cloudflare-rag
# After running this, you'll need to replace the id in wrangler.toml
npx wrangler kv namespace create rate-limiter
With:
# Step 1: Run the wrangler command and capture the database_id
output=$(npx wrangler d1 create cloudflare-rag)
# Extract the new database_id from the output using grep and cut
new_database_id=$(echo "$output" | grep "database_id =" | cut -d '"' -f 2)
# Step 2: Replace the old database_id in the wrangler.toml file
sed -i '' "s/database_id = \".*\"/database_id = \"$new_database_id\"/" wrangler.toml
echo "Updated wrangler.toml with new database_id: $new_database_id"
# Step 3: Create the KV namespace and capture the id
kv_output=$(npx wrangler kv namespace create rate-limiter)
new_kv_id=$(echo "$kv_output" | grep "id =" | awk -F '"' '{print $2}')
# Step 4: Replace the old KV id in the wrangler.toml file for the rate_limiter binding
sed -i '' "/\[\[kv_namespaces\]\]/,/^\[/{
/binding = \"rate_limiter\"/{
n
s/id = \".*\"/id = \"$new_kv_id\"/
}
}" wrangler.toml
echo "Updated wrangler.toml with new KV id for rate_limiter: $new_kv_id"
In order to automatically update the wrangler.toml with the new D1 and KV IDs.
DavidJKTofan
changed the title
D1 database tables missing
D1 database tables missing & improvements to setup.sh
Sep 5, 2024
Add the following command to the https://github.com/RafalWilinski/cloudflare-rag/blob/main/setup.sh setup file, after creating the D1 database, in order to automatically create the necessary tables too:
The text was updated successfully, but these errors were encountered: