You could make the queries via the D1 API? It's quite a bit slower, but I would think it is a *bit*
You could make the queries via the D1 API? It's quite a bit slower, but I would think it is a bit easier than splitting up your app like that
database_id and a different preview_database_id (one is called prod-main the other dev-main, but in the file i have just database_name = "prod-main") will it still work?migrations folder don't get applied automatically if someone pushes a new sql file, right? if that's the case however, how can i disable that behaviour?number[] instead of ArrayBuffer? Seems weird because the docs show that they should map to ArrayBuffers.wrangler.toml file I have this:preview_database_id to the uuid of the preview database would suffice, but apparently it doesn't. In the D1 documentation I could only find https://developers.cloudflare.com/d1/configuration/environments/ but the config used looks vastly different than mine. what do I have to do? database_id to the preview envwrangler.toml:wrangler d1 migrations apply prod-main --local (or even without --local) it says: wrangler d1 migrations apply prod-main -e production --localpreview and a production environment variable has made it not work locally inside the svelte kit app this is my app.d.tsproduction variable in both Platform and where I use it: env.production.db but no diceTypeError: Cannot read properties of undefined (reading 'prepare')Unlike Workers Environments, production and preview are the only two options available via [env.<ENVIRONMENT>] on Pages
/api/create/[user] routeconst result = await db.select().from(schema.users); also doesn't query, same errorenv: {},... so it's not loading anythingsvelte.config.js file i had to set platformProxy.environment to 'production' inside the adapter's configprod-maindev-maindatabase_name = "prod-main"migrationsnumber[]ArrayBuffercurl "http://localhost:8787/__scheduled?cron=*+*+*+*+*"Error: Error: D1_ERROR: no such table: image: SQLITE_ERROR - Cause: Error: D1_ERROR: no such table: image: SQLITE_ERROR[[d1_databases]]
binding = "db"
database_name = "prod-main"
database_id = "[uuid1]"
preview_database_id = "[uuid2]"wrangler d1 migrations apply prod-main --local--local ⛅️ wrangler 3.72.0
-------------------
✘ [ERROR] Couldn't find a D1 DB with the name or binding 'prod-main' in wrangler.toml.wrangler d1 migrations apply prod-main -e production --localproductionproductionapp.d.tsPlatformenv.production.dbTypeError: Cannot read properties of undefined (reading 'prepare')/api/create/[user]const result = await db.select().from(schema.users);env: {},svelte.config.jsplatformProxy.environment'production'name = "[the name]"
compatibility_date = "2024-07-29"
pages_build_output_dir = ".svelte-kit/cloudflare"
[[env.production.d1_databases]]
binding = "db"
database_name = "prod-main"
database_id = "524d4c4f-410b-46f9-9a87-2dc4f6110b1c"
[[env.preview.d1_databases]]
binding = "db"
database_name = "dev-main"
database_id = "025df237-d405-4f57-859f-ad3a055fd74b"interface Platform {
env: {
db: D1Database;
};
}interface Platform {
env: {
db: D1Database;
};
}const db = await drizzle(platform?.env.db, { schema });export const GET: RequestHandler = async ({ params, platform }) => {
if (platform === undefined) return new Response('err');
if (params.user === undefined) return new Response('err');
const db = await drizzle(platform?.env.db, { schema });
const result = await db.insert(schema.users).values({ name: params.user });
return new Response(JSON.stringify(result));
};