does it work if you combine the SQL onto a single line? like ``` `SELECT * FROM categories JOIN imag
does it work if you combine the SQL onto a single line? like
`SELECT * FROM categories JOIN images_categories ON categories.id = images_categories.category_id JOIN images ON images_categories.image_id = images.id;`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?Failed to reach database. Please try again later. and when trying to access the url, it says the DB has just been successfully created. Any tips?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)
);//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);
}
};postedpostedpostedretryretryretryCREATE INDEX post_posted_retry_idx ON post (posted, retry);Error: D1_ERROR: FOREIGN KEY constraint failed
at D1Database._sendOrThrow (cloudflare-internal:d1-api:66:19)