not when i change the db when i make any change to the app, because for the local database to be act
not when i change the db when i make any change to the app, because for the local database to be active we have to run wrangler dev not npm run dev
integer('id', { mode: 'timestamp' }) behaves in a similar way{"error":"Unauthorized, missing DB in environment"}
Error: D1_ERROR: Wrong number of parameter bindings for SQL query.date()--remote or --local with a recent version of wrangler?? is in my statement, there is a syntax error, regardless of where it is in the project
integer('id', { mode: 'timestamp' }){"error":"Unauthorized, missing DB in environment"}Error: D1_ERROR: Wrong number of parameter bindings for SQL query.date()--remote?const timestamp = customType<
{ data: Date; driverData: string; }
>({
dataType() {
return 'text';
},
fromDriver(value: string): Date {
return new Date(value);
},
toDriver(value: Date): string {
try {
return value.toISOString();
} catch (e) {
console.log(`failed to covert ${JSON.stringify(value)} to iso string`)
throw e;
}
},
});select "id", "mem_type", "name", "email", "tickets_used", "tickets_remaining", "end_date" from "members" where
"members"."end_date" < date('now', '+? days')
AND "members"."end_date" > date('now', '+? days')
AND NOT EXISTS (
SELECT 1
FROM "emails"
WHERE "members"."id" = "emails"."mem_id"
AND "emails"."time_sent" < date('now', '-? days')
)
-- params: [7, 1, 7]router.post('/:brand/:slug', async (r,e,c) => {
const brand = r.brand;
const slug = r.slug;
const db = e.LINK_DB
const body = await r.json();
const stmt = db.prepare(`INSERT INTO ? (slug, type, data, clicks) VALUES ('?', "ArtistLanding", '?', 0)`)
stmt.bind(brand,slug,body.data)
return await stmt.run();
}){
"status": 500,
"error": "D1_ERROR: near \"?\": syntax error at offset 12"
}