hello can i connect to D1 using dbeaver or something like that?
hello can i connect to D1 using dbeaver or something like that?
p.posted and p.retry but it's still scanning the whole table p. Is there anyway to reduce scanned rows of the query above? I'm running this query every minutes so everyday I'm wasting 10-20k scanned row. This table is going to grow much larger so the waste will be more significant
posted and retry, or two individual indexes?posted and retry if I place the condition in the correct order right?posted and retry should be used
FOREIGN KEY constraint failed




wrangler d1 info <dbname> will tell youwrangler d1 info <dbname> for that DB?p.postedp.retrypSELECT *
FROM categories
JOIN images_categories ON categories.id = images_categories.category_id
JOIN images ON images_categories.image_id = images.id;Error: D1_ERROR: A prepared SQL statement must contain only one statement. let result = await platform!.env.DB.prepare(
`SELECT *
FROM categories
JOIN images_categories ON categories.id = images_categories.category_id
JOIN images ON images_categories.image_id = images.id;
`
).all();`SELECT * FROM categories JOIN images_categories ON categories.id = images_categories.category_id JOIN images ON images_categories.image_id = images.id;`postedpostedpostedretryretryretryFOREIGN KEY constraint failedwrangler d1 info <dbname>wrangler d1 info <dbname>CREATE INDEX post_posted_retry_idx ON post (posted, retry);CREATE TABLE IF NOT EXISTS carts (
id INTEGER PRIMARY KEY,
cartId INTEGER NOT NULL,
branchId INTEGER NOT NULL,
name TEXT NOT NULL,
productId INTEGER NOT NULL,
price REAL NOT NULL, -- << HERE
size TEXT NOT NULL,
quantity TEXT NOT NULL,
customerNotes TEXT NOT NULL DEFAULT '',
discount REAL,
discountName TEXT,
discountDescription TEXT DEFAULT '',
discountEndDate REAL,
createdBy INTEGER NOT NULL,
createdAt REAL NOT NULL,
updatedBy INTEGER,
updatedAt REAL,
status INTEGER NOT NULL,
FOREIGN KEY (branchId) REFERENCES branches(id),
FOREIGN KEY (cartId) REFERENCES cartIds(id),
FOREIGN KEY (productId) REFERENCES products(id),
FOREIGN KEY (createdBy) REFERENCES users (id),
FOREIGN KEY (updatedBy) REFERENCES users (id)
);Error: D1_ERROR: FOREIGN KEY constraint failed
at D1Database._sendOrThrow (cloudflare-internal:d1-api:66:19)//hooks.server.ts
import { drizzle } from 'drizzle-orm/d1';
const injectD1 = async (event: RequestEvent<Partial<Record<string, string>>, string | null>) => {
try {
if (event.platform?.env?.DATABASE) {
event.locals.DRIZZLE = drizzle(event.platform.env.DATABASE);
event.locals.D1 = event.platform.env.DATABASE;
}
...
} catch (error) {
console.log('🚀 ~ file: hooks.server.ts:27 ~ consthandle:Handle= ~ error:', error);
}
};