Hi. Is this a good place to ask technical questions e.g., code-related issues like using an orm with
Hi. Is this a good place to ask technical questions e.g., code-related issues like using an orm with d1?
D1 in a Durable Object transaction insteadYou'll never guess what D1 uses
wrangler d1 execute default to local (to match wrangler dev), and I think it's in a good place to try out: https://github.com/cloudflare/workers-sdk/pull/4930npx wrangler@d1. For example:--local for local, --remote for remotewrangler.tomlwrangler.toml. Can't seem to figure out a way to use wrangler to recreate the dangling Pages binding to the deleted D1 database and have to go to the dashboard.

npx wrangler d1 migrations apply db due to which I can't apply migrations in my github actions workflow.npx wrangler d1 execute."apply:preview": "npx is-ci && npx wrangler d1 migrations apply db --preview"
npx wrangler d1 execute job-hunt-db --local --persist-to /tmp/job-hunt-tmp-data --command="SELECT * FROM TargetRoleAnalysis"WRANGLER_LOG=debug npx wrangler d1 migrations apply db --preview and DM me the result? npx is-ci && shouldn't be necessary in GH Actions--persist-to in every command you use if you customise it[[ env.preview.d1_databases ]]
binding = "D1"
database_name = "rcms-d1-preview"
database_id = "618bb8af-dad2-482d-82b0-ffd0780073f0" # pnpm wrangler d1 info rcms-d1-preview
preview_database_id = "D1"
migrations_table = "d1_migrations"
migrations_dir = "drizzle"import { $, glob } from "zx";
/**
* Reset the local d1 database violently.
* Run any migrations and seed.
*/
await $`rm -rf ./.wrangler`;
// Create db.
// await $`pnpm wrangler d1 execute local-d1-dev --local --command "select datetime('now');"`;
// https://github.com/cloudflare/workers-sdk/issues/5092
await $`pnpm wrangler d1 execute local-d1-dev --local --command "pragma foreign_keys = ON;"`;
const migrationFiles = await glob("./drizzle/*.sql");
console.log({ migrationFiles });
if (migrationFiles.length > 0) {
await $`wrangler d1 migrations apply local-d1-dev --local`;
await $`pnpm d1:seed`;
}
const sqliteFiles = await glob("./.wrangler/**/*.sqlite");
console.log({ sqliteFiles });
if (sqliteFiles.length !== 1) {
console.error("Expected exactly one sqlite file under .wrangler");
process.exit(1);
}
const statements = `
.schema
pragma table_list`;
await $`echo ${statements} | sqlite3 ${sqliteFiles[0]}`;
console.log(`sqlite3 ${sqliteFiles[0]}`);PRAGMA foreign_keys = OFF;
DROP TABLE IF EXISTS Users;
DROP TABLE IF EXISTS Rooms;
DROP TABLE IF EXISTS Sessions;
PRAGMA foreign_keys = ON;