/site directory where I keep my frontend and is what is built when I run npm run build to the /dist directory./functions directory which is of course where I am storing my backend API./sql directory to house the SQL and migrations?count(distinct "id") I get rows_written in meta?

849f0f66-2128-44b7-ab25-8776dacfb571 (in case it's needed)

SQL execute error: database or disk is full errors on our D1 db, we are using 104.86 MB and are on a paid plan. (DB ID is 2211f2a0-4f44-4b32-b1a6-01b4d3f09f0a if it helps)npx wrangler d1 info <dbname> on that DB?[ERROR] Internal error in D1 storage caused object to be reset. [code: 7500]pragma foreign_keys=0 does not work in D1’s automatic transactions. I found some advice in this discord to use pragma defer_foreign_keys=1 which still didn’t fix my issue, just got a mysterious error message. Finally I stumbled on this hint: https://sqlite.org/forum/forumpost/825039816c3f0097 If you also reset pragma defer_foreign_keys=0 at the end of the script it will completely skip the foreign key checking. Feels a bit risky since even pragma foreign_key_check is disabled in D1 and I don’t have a good way to confirm my data is still valid. But I’m glad I could at least apply my migration.--local flag have a more deterministic name? Right now my db file is located at .wrangler/state/v3/d1/miniflare-D1DatabaseObject/e7352547963de7050bd7d94658afc4fe78b61811b7815da12d90be8e863abf4d.sqlite, but I'd prefer something more memorable. I'm also not sure if someone else who runs the setup locally would get the same file name.--persist-local=db.sqlite, but that seems to change the top level folder only, so then the DB file is at db.sqlite/v3/d1/miniflare-D1DatabaseObject/e7352547963de7050bd7d94658afc4fe78b61811b7815da12d90be8e863abf4d.sqlite


for (const { question, answer } of objectsData) {
// Check if the row with the same question and answer already exists
const existingRow = await env.faq.prepare().run(question, answer);
if (!existingRow) {
// If the row doesn't exist, insert it into the table
await env.faq.prepare().run(question, answer);
}
}
{
"collectionItems": {
"success": true,
"meta": {
"served_by": "v3-prod",
"duration": 0.6292,
"changes": 0,
"last_row_id": 0,
"changed_db": false,
"size_after": 3862528,
"rows_read": 1014,
"rows_written": 342
},
"results": [
{
"count(distinct \"id\")": 342
}
]
}
}➜ ~ npx wrangler d1 info odometer ✘ 1
┌────────────┬──────────────────────────────────────┐
│ │ 2211f2a0-4f44-4b32-b1a6-01b4d3f09f0a │
├────────────┼──────────────────────────────────────┤
│ name │ odometer │
├────────────┼──────────────────────────────────────┤
│ created_at │ 2023-06-08T10:24:40.711Z │
├────────────┼──────────────────────────────────────┤
│ version │ alpha │
├────────────┼──────────────────────────────────────┤
│ num_tables │ 2 │
├────────────┼──────────────────────────────────────┤
│ file_size │ 105 MB for (const { question, answer } of objectsData) {
// Check if the row with the same question and answer already exists
const existingRow = await env.faq.prepare().run(question, answer);
if (!existingRow) {
// If the row doesn't exist, insert it into the table
await env.faq.prepare().run(question, answer);
}
}import { drizzle } from "drizzle-orm/better-sqlite3";
import Database from "better-sqlite3";
import { migrate } from "drizzle-orm/better-sqlite3/migrator";
const sqlite = new Database(
"../.wrangler/state/v3/d1/miniflare-D1DatabaseObject/8c4adb7a51078a272a8336d1d6f606acb37a5564b94ce38b4862ef2734d493a1.sqlite"
);
const db = drizzle(sqlite);
migrate(db, { migrationsFolder: "drizzle" });
sqlite.close();